Improved an error message when there's no constructor for a tag.

This commit is contained in:
Ferdinand Majerech 2012-04-01 16:57:21 +02:00
parent fdceb1bdcb
commit 5aacfe79b2

View file

@ -314,8 +314,13 @@ final class Constructor
if((is(T : string) || is(T == Node[]) || is(T == Node.Pair[])) &&
(is(U : CollectionStyle) || is(U : ScalarStyle)))
{
static type = is(T : string) ? "scalar" :
is(T == Node[]) ? "sequence" :
is(T == Node.Pair[]) ? "mapping" :
"ERROR";
enforce((tag in *delegates!T) !is null,
new Error("No constructor function for tag " ~ tag.get(), start, end));
new Error("No constructor function from " ~ type ~
" for tag " ~ tag.get(), start, end));
Node node = Node(value);
try
{