Skip to content

Commit

Permalink
test the raising of exception
Browse files Browse the repository at this point in the history
  • Loading branch information
almazgimaev committed Oct 25, 2023
1 parent a1749e5 commit 721defd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions supervisely/train/src/sly_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ def train(api: sly.Api, task_id, context, state, app_logger):
upload_artifacts(g.local_artifacts_dir, g.remote_artifacts_dir)
set_task_output()
except Exception as e:
msg = f"Something went wrong. Find more info in the app logs. {repr(e)}"
my_app.show_modal_window(msg, level="error")
sly.logger.error(msg, exc_info=True, extra={ 'exc_str': str(e)})
api.app.set_field(task_id, "state.started", False)
# msg = f"Something went wrong. Find more info in the app logs. {repr(e)}"
# my_app.show_modal_window(msg, level="error")
# sly.logger.error(msg, exc_info=True, extra={ 'exc_str': str(e)})
# api.app.set_field(task_id, "state.started", False)
raise e

# stop application
get_progress_cb("Finished, app is stopped automatically", 1)(1)
Expand All @@ -155,7 +156,7 @@ def main():
try:
ui.init(data, state)
except Exception as e:
raise Exception(f"Data loading or UI initialization error. {repr(e)}")
raise Exception(f"UI initialization error. {str(e)}")

my_app.run(data=data, state=state)

Expand Down

0 comments on commit 721defd

Please sign in to comment.