diff --git a/source/jstruct/deserializer.d b/source/jstruct/deserializer.d index 09781c5..ba4e709 100644 --- a/source/jstruct/deserializer.d +++ b/source/jstruct/deserializer.d @@ -4,7 +4,7 @@ module jstruct.deserializer; import std.json; -import jstruct.exceptions : SerializationError; +import jstruct.exceptions : DeserializationError; import std.traits : FieldTypeTuple, FieldNameTuple, isArray; /** @@ -191,8 +191,7 @@ public RecordType fromJSON(RecordType)(JSONValue jsonIn) } catch(JSONException e) { - // TOOD: Should be DEserialization error - throw new SerializationError(); + throw new DeserializationError(); } } @@ -287,7 +286,7 @@ unittest Person person = fromJSON!(Person)(json); assert(false); } - catch(SerializationError) + catch(DeserializationError) { assert(true); } diff --git a/source/jstruct/exceptions.d b/source/jstruct/exceptions.d index 9383d2d..113ec65 100644 --- a/source/jstruct/exceptions.d +++ b/source/jstruct/exceptions.d @@ -15,3 +15,11 @@ public final class SerializationError : JStructException super("Error serializing"); } } + +public final class DeserializationError : JStructException +{ + this() + { + super("Error deserializing"); + } +} \ No newline at end of file