Class LrcParseException
- Namespace
- ModernLrc
- Assembly
- ModernLrc.dll
Thrown for catastrophic parse failures: encoding-detect failure, or a Strict-mode error on the first Error-severity diagnostic. PartialResult is populated for content failures; null for encoding/IO failures. Infrastructure errors (IOException, UnauthorizedAccessException, OperationCanceledException, etc.) are NOT wrapped — they propagate raw.
[SuppressMessage("Design", "CA1032:Implement standard exception constructors", Justification = "Spec deliberately omits the inner-exception overload; only message-only and rich constructors are exposed by design.")]
public sealed class LrcParseException : Exception, ISerializable
- Inheritance
-
LrcParseException
- Implements
- Inherited Members
Examples
var options = new LrcParseOptions { Strictness = LrcStrictness.Strict };
try
{
var result = LrcParser.Parse(text, options);
}
catch (LrcParseException ex)
{
Console.WriteLine($"Parse failed: {ex.FirstError?.Code} at L{ex.FirstError?.Line}");
// ex.PartialResult holds whatever was parsed before the failure
// ex.FilePath is set when raised by ParseFile / ParseFileAsync
}
Constructors
LrcParseException(string)
Message-only constructor (encoding-detect failure path).
public LrcParseException(string message)
Parameters
messagestring
LrcParseException(string, LrcParseResult?, LrcDiagnostic?, string?)
Rich constructor used by Strict-mode failures.
public LrcParseException(string message, LrcParseResult? partialResult, LrcDiagnostic? firstError, string? filePath)
Parameters
messagestringpartialResultLrcParseResultfirstErrorLrcDiagnosticfilePathstring
Properties
FilePath
File path when raised by ParseFile*; null otherwise.
public string? FilePath { get; }
Property Value
FirstError
The first Error-severity diagnostic that triggered the throw, if any.
public LrcDiagnostic? FirstError { get; }
Property Value
PartialResult
The partial result built up to the failure point, if any.
public LrcParseResult? PartialResult { get; }