Skip to content

Fix wrong types on Run error returns #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions simvue/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,11 @@ def save_object(

# Register file
try:
file_save = self._simvue.save_file(data)
return self._simvue is not None and self._simvue.save_file(data) is not None
except RuntimeError as e:
self._error(f"{e.args[0]}")
return False

return self._simvue is not None and file_save is not None

@skip_if_failed("_aborted", "_suppress_errors", False)
@check_run_initialised
@pydantic.validate_call
Expand Down Expand Up @@ -1409,14 +1407,12 @@ def set_status(
self._status = status

try:
updated = self._simvue.update(data)
if self._simvue and self._simvue.update(data):
return True
except RuntimeError as e:
self._error(f"{e.args[0]}")
return False

if self._simvue and updated:
return True

return False

@skip_if_failed("_aborted", "_suppress_errors", False)
Expand Down Expand Up @@ -1733,7 +1729,7 @@ def create_alert(
alerts = self._simvue.list_alerts()
except RuntimeError as e:
self._error(f"{e.args[0]}")
return alerts
return None

if alerts:
for existing_alert in alerts:
Expand All @@ -1748,7 +1744,7 @@ def create_alert(
response = self._simvue.add_alert(alert)
except RuntimeError as e:
self._error(f"{e.args[0]}")
return False
return None
if response:
if "id" in response:
alert_id = response["id"]
Expand All @@ -1764,7 +1760,7 @@ def create_alert(
self._simvue.update(data)
except RuntimeError as e:
self._error(f"{e.args[0]}")
return False
return None

return alert_id

Expand Down
Loading