Skip to content

Commit ba04e47

Browse files
committed
Added another exception check
1 parent f90240e commit ba04e47

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/openapi_python_generator/generate_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import httpx
55
from httpx import ConnectError, ConnectTimeout
6-
from orjson import orjson
6+
from orjson import orjson, JSONDecodeError
77
import typer
88
from pydantic import ValidationError
99
import autopep8
@@ -43,9 +43,9 @@ def get_open_api(path: Union[str,Path]) -> OpenAPI:
4343
except (ConnectError,ConnectTimeout):
4444
typer.echo(f"Could not connect to {path}.")
4545
raise ConnectError(f"Could not connect to {path}.")
46-
except ValidationError:
46+
except (ValidationError,JSONDecodeError):
4747
typer.echo(f"File {path} is not a valid OpenAPI 3.0 specification, or there may be a problem with your JSON.")
48-
raise
48+
raise ValidationError(f"File {path} is not a valid OpenAPI 3.0 specification, or there may be a problem with your JSON.")
4949

5050

5151
def write_data(data: ConversionResult, output: str):

0 commit comments

Comments
 (0)