Skip to content

Commit f90240e

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

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
@@ -2,7 +2,7 @@
22
from typing import Optional, Union
33

44
import httpx
5-
from httpx import ConnectError
5+
from httpx import ConnectError, ConnectTimeout
66
from orjson import orjson
77
import typer
88
from pydantic import ValidationError
@@ -40,9 +40,9 @@ def get_open_api(path: Union[str,Path]) -> OpenAPI:
4040
except FileNotFoundError:
4141
typer.echo(f"File {path} not found. Please make sure to pass the path to the OpenAPI 3.0 specification.")
4242
raise
43-
except ConnectError:
43+
except (ConnectError,ConnectTimeout):
4444
typer.echo(f"Could not connect to {path}.")
45-
raise
45+
raise ConnectError(f"Could not connect to {path}.")
4646
except ValidationError:
4747
typer.echo(f"File {path} is not a valid OpenAPI 3.0 specification, or there may be a problem with your JSON.")
4848
raise

0 commit comments

Comments
 (0)