Exception style changes.

This commit is contained in:
Ferdinand Majerech 2014-07-23 18:15:13 +02:00
parent f8c1d0204b
commit 8f00c503e2

View file

@ -16,10 +16,10 @@ import std.conv;
alias to!string str; alias to!string str;
///Base class for all exceptions thrown by D:YAML. /// Base class for all exceptions thrown by D:YAML.
class YAMLException : Exception class YAMLException : Exception
{ {
///Construct a YAMLException with specified message and position where it was thrown. /// Construct a YAMLException with specified message and position where it was thrown.
public this(string msg, string file = __FILE__, int line = __LINE__) public this(string msg, string file = __FILE__, int line = __LINE__)
@trusted pure nothrow @trusted pure nothrow
{ {
@ -62,9 +62,9 @@ package:
//Base class of YAML exceptions with marked positions of the problem. //Base class of YAML exceptions with marked positions of the problem.
abstract class MarkedYAMLException : YAMLException abstract class MarkedYAMLException : YAMLException
{ {
//Construct a MarkedYAMLException with specified context and problem. // Construct a MarkedYAMLException with specified context and problem.
this(string context, Mark contextMark, string problem, Mark problemMark, this(string context, Mark contextMark, string problem, Mark problemMark,
string file = __FILE__, int line = __LINE__) @safe pure string file = __FILE__, int line = __LINE__) @safe pure nothrow
{ {
const msg = context ~ '\n' ~ const msg = context ~ '\n' ~
(contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~ (contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~
@ -72,7 +72,7 @@ abstract class MarkedYAMLException : YAMLException
super(msg, file, line); super(msg, file, line);
} }
//Construct a MarkedYAMLException with specified problem. // Construct a MarkedYAMLException with specified problem.
this(string problem, Mark problemMark, string file = __FILE__, int line = __LINE__) this(string problem, Mark problemMark, string file = __FILE__, int line = __LINE__)
@safe pure @safe pure
{ {
@ -80,7 +80,9 @@ abstract class MarkedYAMLException : YAMLException
} }
} }
//Constructors of YAML exceptions are mostly the same, so we use a mixin. // Constructors of YAML exceptions are mostly the same, so we use a mixin.
//
// See_Also: YAMLException
template ExceptionCtors() template ExceptionCtors()
{ {
public this(string msg, string file = __FILE__, int line = __LINE__) public this(string msg, string file = __FILE__, int line = __LINE__)
@ -90,7 +92,9 @@ template ExceptionCtors()
} }
} }
//Constructors of marked YAML exceptions are mostly the same, so we use a mixin. // Constructors of marked YAML exceptions are mostly the same, so we use a mixin.
//
// See_Also: MarkedYAMLException
template MarkedExceptionCtors() template MarkedExceptionCtors()
{ {
public: public:
@ -106,4 +110,9 @@ template MarkedExceptionCtors()
{ {
super(problem, problemMark, file, line); super(problem, problemMark, file, line);
} }
this(ref const(MarkedYAMLExceptionData) data) @safe pure nothrow
{
super(data);
}
} }