Skip to content

Commit 0dd39fc

Browse files
authored
Merge pull request #73 from simvue-io/get_run_exceptions
Raise exception if run does not exist
2 parents 895959c + c1ce176 commit 0dd39fc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

simvue/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ def get_run(self, run, system=False, tags=False, metadata=False):
4848
'metadata': metadata}
4949

5050
response = requests.get(f"{self._url}/api/runs", headers=self._headers, params=params)
51-
response.raise_for_status()
51+
52+
if response.status_code == 404:
53+
if 'detail' in response.json():
54+
if response.json()['detail'] == 'run does not exist':
55+
raise Exception('Run does not exist')
5256

5357
if response.status_code == 200:
5458
return response.json()
5559

56-
return None
60+
raise Exception(response.text)
5761

5862
def get_runs(self, filters, system=False, tags=False, metadata=False, format='dict'):
5963
"""

0 commit comments

Comments
 (0)