Skip to content

Commit 1daada7

Browse files
committed
improve error message when a schema that is not a hash is passed to Schema#initialize
1 parent d7aa909 commit 1daada7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/json-schema/schema.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class Schema
66
attr_accessor :schema, :uri, :validator
77

88
def initialize(schema,uri,parent_validator=nil)
9+
raise ArgumentError, "schema must be a hash; got: #{schema.inspect}" unless schema.is_a?(Hash)
10+
911
@schema = schema
1012
@uri = uri
1113

0 commit comments

Comments
 (0)