Skip to content

Commit 5b4deb0

Browse files
committed
add exception handling
1 parent c401312 commit 5b4deb0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/reliqua/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _get_classes(self, filename):
174174
module = importlib.util.module_from_spec(spec)
175175
try:
176176
spec.loader.exec_module(module)
177-
except Exception as e:
177+
except (ImportError, FileNotFoundError, SyntaxError, TypeError, AttributeError) as e:
178178
print(f"Error loading module {module_name}: {e}")
179179
return classes
180180

src/reliqua/docs.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ def __init__(self, schema):
5858
:param dict schema: Documents JSON schema
5959
:return: None
6060
"""
61+
super().__init__()
6162
self.schema = schema
6263

6364
def on_get(self, _req, resp):
6465
"""
6566
Return the JSON document schema.
6667
67-
:param Response response: Response object
68-
:return: None
68+
:param Request _req: Request object
69+
:param Response resp: Response object
70+
:return: None
6971
"""
7072
resp.set_header("Access-Control-Allow-Origin", "*")
7173
resp.media = self.schema

0 commit comments

Comments
 (0)