Commit 589c2a65 by Aaron Dossett

ISSUE 57 - throw exception if type created with invalid JSON

parent 1e835435
...@@ -93,6 +93,11 @@ public class DefaultMetadataService implements MetadataService { ...@@ -93,6 +93,11 @@ public class DefaultMetadataService implements MetadataService {
TypesDef typesDef = TypesSerialization.fromJson(typeDefinition); TypesDef typesDef = TypesSerialization.fromJson(typeDefinition);
Map<String, IDataType> typesAdded = typeSystem.defineTypes(typesDef); Map<String, IDataType> typesAdded = typeSystem.defineTypes(typesDef);
//TODO A more elegant way to detect failures?
if (typesAdded.size() == 0)
throw new MetadataException("Invalid type definition");
//TODO how do we handle transaction - store failure?? //TODO how do we handle transaction - store failure??
typeStore.store(typeSystem, ImmutableList.copyOf(typesAdded.keySet())); typeStore.store(typeSystem, ImmutableList.copyOf(typesAdded.keySet()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment