Class ValidationException
The exception thrown by AttributeValidator when a field decorated with a Scylla validation attribute fails its check at runtime.
Implements
Inherited Members
Namespace: Scylla.Core.Attributes
Assembly: ScyllaCore.dll
Syntax
public class ValidationException : Exception, ISerializable
Remarks
In addition to the standard Message property (which carries the human-readable failure description), this exception exposes FieldName so that callers can programmatically identify which field caused the problem - useful for Editor tooling or custom error reporting.
This exception is always thrown synchronously inside ValidateObject(object). It is not intended to be caught and swallowed in production code; it represents a configuration error that must be fixed before the application can run correctly. If non-throwing behavior is required, use TryValidateObject(object, out string) instead, which catches this exception internally.
Constructors
ValidationException(string, string)
Initializes a new instance of ValidationException for the named field with the supplied error message.
Declaration
public ValidationException(string fieldName, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | The C# name of the field that failed validation, as returned by
Name via reflection. This value is exposed through
FieldName and is used by tooling to identify the offending field.
Must not be |
| string | message | The human-readable description of the validation failure. This becomes the value
of Message. Either the custom error string supplied in
the validation attribute or a default generated from |
Properties
FieldName
Gets the C# name of the field that failed validation.
Declaration
public string FieldName { get; }
Property Value
| Type | Description |
|---|---|
| string | The exact field name as returned by Name via reflection
(e.g., |