summaryrefslogtreecommitdiff
path: root/lib/custodian
diff options
context:
space:
mode:
Diffstat (limited to 'lib/custodian')
-rw-r--r--lib/custodian/protocoltest.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/custodian/protocoltest.rb b/lib/custodian/protocoltest.rb
index 9efeb0f..7c631c8 100644
--- a/lib/custodian/protocoltest.rb
+++ b/lib/custodian/protocoltest.rb
@@ -34,8 +34,14 @@ class ProtocolTest
# JSON ?
#
if ( line =~ /^\{(.*)\}$/ )
- obj = JSON.parse( line );
- line = obj["line"]
+ begin
+ obj = JSON.parse( line );
+ raise ArgumentError, "JSON object was not a hash" unless obj.kind_of?(Hash)
+ line = obj["line"]
+ raise ArgumentError, "obj[:line] was nil" unless (!line.nil?)
+ rescue =>ex
+ raise ArgumentError, "Line did not deserialize from JSON: #{line} - #{ex}"
+ end
end