Class MarkupException
- Namespace
- Icy.Markup
- Assembly
- IcyUI.dll
The exception raised for every markup error - a malformed document, an unresolvable type or property, a bad value, or a structural rule the document broke.
public class MarkupException : Exception, ISerializable
- Inheritance
-
MarkupException
- Implements
- Inherited Members
- Extension Methods
Remarks
Loading fails on the first error and never returns a partially-constructed tree, so a caught MarkupException always means nothing was produced.
Message is prefixed with the source position in the standard compiler format
(path(line,column): message) whenever the loader knows it, which it does for anything anchored to a
node, since documents are parsed with SetLineInfo.
Constructors
MarkupException(string, string?, int, int, Exception?)
Initializes a new instance of the MarkupException class.
public MarkupException(string message, string? sourcePath = null, int line = 0, int column = 0, Exception? innerException = null)
Parameters
messagestringA description of what went wrong.
sourcePathstringThe path of the markup file, or null when it isn't known.
lineintThe 1-based line the error occurred on, or
0when it isn't known.columnintThe 1-based column the error occurred on, or
0when it isn't known.innerExceptionExceptionThe underlying exception, when this error wraps one.
Properties
Column
Gets the 1-based column the error occurred on, or 0 when it isn't known.
public int Column { get; }
Property Value
Description
Gets the error description without the source-position prefix that Message carries.
public string Description { get; }
Property Value
Line
Gets the 1-based line the error occurred on, or 0 when it isn't known.
public int Line { get; }
Property Value
SourcePath
Gets the path of the markup file the error occurred in, or null when it isn't known.
public string? SourcePath { get; }
Property Value
Methods
At(string, IXmlLineInfo?, string?, Exception?)
Creates an exception anchored at the position of an XML node.
public static MarkupException At(string message, IXmlLineInfo? node, string? sourcePath, Exception? innerException = null)
Parameters
messagestringA description of what went wrong.
nodeIXmlLineInfoThe node the error is about; its line info is used when it has any.
sourcePathstringThe path of the markup file, or null when it isn't known.
innerExceptionExceptionThe underlying exception, when this error wraps one.
Returns
- MarkupException
An exception carrying
node's position.