# ErrorCode

> Uniquely identifies a type of error which may occur when generating reflection information.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEditor.ShaderApiReflection](/engine/6000.5/script-reference/unityeditor/shaderapireflection.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public enum ErrorCode
```

## Remarks

Each value of this enum represents a different type of error, the details of which may be found in [LogMessage.Text](/engine/6000.5/script-reference/unityeditor/shaderapireflection/logmessage/text.md).

Additional Resources: [LogMessage.ErrorCode](/engine/6000.5/script-reference/unityeditor/shaderapireflection/logmessage/errorcode.md).

## Examples

```csharp
using UnityEditor;
using UnityEditor.ShaderApiReflection;
using UnityEngine;

// This example adds a menu item which re-logs any reflection errors reported by shader includes
// selected in the project view.
public class ShaderIncludeReflectionErrorPrinter
{
    [MenuItem("Examples/ShaderIncludeReflectionErrorPrinter")]
    static void PrintErrors()
    {
        // Visit each selected object
        foreach (Object selectedObject in Selection.objects)
        {
            // Check if the object is a ShaderInclude
            if (selectedObject is ShaderInclude includeObject)
            {
                // Re-log each reflection message
                foreach (LogMessage message in includeObject.Reflection.LogMessages)
                {
                    string formattedMessage =
                        $"{message.ErrorCode} {message.MessageSeverity} at {message.Location.FilePath}"
                        + $" (line {message.Location.Line}): {message.Text}";
                    if (message.MessageSeverity == LogMessage.Severity.Error)
                        Debug.LogError(formattedMessage);
                    else
                        Debug.LogWarning(formattedMessage);
                }
            }
        }
    }
}
```

## Fields

| Value                                                                                                                           | Description                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| [AttributeHint](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/attributehint.md)                     | A hint tag used an XML attribute.                                                                          |
| [DeepHint](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/deephint.md)                               | A hint tag was nested within another hint tag.                                                             |
| [FailedToLex](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/failedtolex.md)                         | The shader source code failed to tokenize.                                                                 |
| [MissingParameterName](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/missingparametername.md)       | An XML tag which requires a function parameter name lacked one.                                            |
| [MultiplyDefinedHint](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/multiplydefinedhint.md)         | A hint was defined multiple times.                                                                         |
| [NestedHintContainer](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/nestedhintcontainer.md)         | A hint tag was nested within another hint tag.                                                             |
| [NonexistentParameter](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/nonexistentparameter.md)       | An XML tag referenced a nonexisted function parameter.                                                     |
| [UnexpectedEndOfFile](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/unexpectedendoffile.md)         | The shader parser reached the end-of-file marker while searching for a token.                              |
| [UnexpectedToken](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/unexpectedtoken.md)                 | The shader parser expected one token but found another.                                                    |
| [Unknown](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/unknown.md)                                 | An unspecified error occurred.                                                                             |
| [UnmatchedScopeDelimiter](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/unmatchedscopedelimiter.md) | The shader source code lacked a closing brace.                                                             |
| [UnsupportedShaderSyntax](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/unsupportedshadersyntax.md) | The shader source code made use of a language construct not supported by the shader API reflection system. |
| [XMLSyntaxError](/engine/6000.5/script-reference/unityeditor/shaderapireflection/errorcode/xmlsyntaxerror.md)                   | A comment decorating a shader function contained malformed XML.                                            |
