@@ -184,7 +184,7 @@ def parse_args(args):
184
184
def make_validator (schema_path , validator_class , output_writer ):
185
185
try :
186
186
schema_obj = _load_json_file (schema_path )
187
- except (json . JSONDecodeError , FileNotFoundError ) as exc :
187
+ except (ValueError , FileNotFoundError ) as exc :
188
188
output_writer .write_parsing_error (schema_path , exc )
189
189
raise exc
190
190
@@ -201,7 +201,7 @@ def make_validator(schema_path, validator_class, output_writer):
201
201
def load_stdin (stdin , output_writer ):
202
202
try :
203
203
instance_obj = json .load (stdin )
204
- except json . JSONDecodeError as exc :
204
+ except ValueError as exc :
205
205
output_writer .write_parsing_error ("stdin" , exc )
206
206
raise exc
207
207
return instance_obj
@@ -210,7 +210,7 @@ def load_stdin(stdin, output_writer):
210
210
def load_instance_file (instance_path , output_writer ):
211
211
try :
212
212
instance_obj = _load_json_file (instance_path )
213
- except (json . JSONDecodeError , FileNotFoundError ) as exc :
213
+ except (ValueError , FileNotFoundError ) as exc :
214
214
output_writer .write_parsing_error (instance_path , exc )
215
215
raise exc
216
216
return instance_obj
@@ -246,7 +246,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin):
246
246
arguments ["validator" ],
247
247
output_writer ,
248
248
)
249
- except (FileNotFoundError , json . JSONDecodeError , SchemaError ):
249
+ except (FileNotFoundError , ValueError , SchemaError ):
250
250
return False
251
251
252
252
errored = False
@@ -259,7 +259,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin):
259
259
validator ,
260
260
output_writer ,
261
261
)
262
- except (json . JSONDecodeError , FileNotFoundError , ValidationError ):
262
+ except (ValueError , FileNotFoundError , ValidationError ):
263
263
errored = True
264
264
elif (
265
265
stdin is sys .stdin and not sys .stdin .isatty ()
@@ -272,7 +272,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin):
272
272
validator ,
273
273
output_writer ,
274
274
)
275
- except (json . JSONDecodeError , ValidationError ):
275
+ except (ValueError , ValidationError ):
276
276
errored = True
277
277
278
278
return errored
0 commit comments