Skip to content

Commit

Permalink
Add MarkedYAMLException#mark (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan authored Dec 27, 2021
1 parent a680555 commit f7dc530
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/dyaml/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ struct MarkedYAMLExceptionData
// Base class of YAML exceptions with marked positions of the problem.
abstract class MarkedYAMLException : YAMLException
{
/// Position of the error.
Mark mark;

// Construct a MarkedYAMLException with specified context and problem.
this(string context, const Mark contextMark, string problem, const Mark problemMark,
string file = __FILE__, size_t line = __LINE__) @safe pure nothrow
Expand All @@ -102,6 +105,7 @@ abstract class MarkedYAMLException : YAMLException
(contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~
problem ~ '\n' ~ problemMark.toString() ~ '\n';
super(msg, file, line);
mark = problemMark;
}

// Construct a MarkedYAMLException with specified problem.
Expand All @@ -110,6 +114,7 @@ abstract class MarkedYAMLException : YAMLException
@safe pure nothrow
{
super(problem ~ '\n' ~ problemMark.toString(), file, line);
mark = problemMark;
}

/// Construct a MarkedYAMLException from a struct storing constructor parameters.
Expand Down

0 comments on commit f7dc530

Please sign in to comment.