Class CStructConstraintException
- Namespace
- CStructSharp.Diagnostics
- Assembly
- CStructSharp.dll
Represents a read that stopped because a field's value did not satisfy an @expect or @supports
constraint of the layout. It is a CStructReadException with the code
ReadFailed; Kind says whether the data is malformed or merely unsupported.
public sealed class CStructConstraintException : CStructReadException, ISerializable
- Inheritance
-
CStructConstraintException
- Implements
- Inherited Members
Constructors
CStructConstraintException(ConstraintKind, string, string, string?, string?)
Creates a constraint failure.
public CStructConstraintException(ConstraintKind kind, string constraint, string message, string? label = null, string? description = null)
Parameters
kindConstraintKindWhether the value is invalid or the layout does not support it.
constraintstringThe condition as written in the layout.
messagestringThe diagnostic naming the field and the condition.
labelstringThe label the layout gave the constraint, or null when it has none.
descriptionstringThe message the layout gave the constraint, or null when it has none; see Description.
Properties
Constraint
Gets the condition that was not satisfied, as written in the layout.
public string Constraint { get; }
Property Value
Description
Gets the message the layout gave the constraint (@expect(magic == 0xEF53, "ext.magic", "Not an ext superblock"));
null when the constraint has none. When present it replaces the generated sentence in Message,
which then still ends with the position facts and the Label in brackets.
public string? Description { get; }
Property Value
Kind
Gets whether the data is malformed (@expect) or unsupported (@supports).
public ConstraintKind Kind { get; }
Property Value
Label
Gets the label the layout gave the constraint (@expect(magic == 0xEF53, "ext.magic")), a stable name or
wording a caller can match instead of the message; null when the constraint has none.
public string? Label { get; }
Property Value
Message
Gets the diagnostic naming the field and the condition (or the layout's own message), with the position facts a failure carries.
public override string Message { get; }