-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: catch network exceptions and keep the loop going #22
Conversation
looks fine, but maybe better to do it with logging, like here?https://github.com/Visionatrix/Visionatrix/blob/f86cb154527d5ee4429468902a80c8726a880257/visionatrix/routes/tasks.py#L610-L626 |
lib/main.py
Outdated
except Exception as e: # noqa | ||
print(str(e), flush=True) | ||
nc = NextcloudApp() | ||
nc.log(LogLvl.ERROR, str(e)) | ||
nc.providers.task_processing.report_result(task["id"], error_message=str(e)) | ||
with suppress(Exception): | ||
nc = NextcloudApp() | ||
nc.log(LogLvl.ERROR, str(e)) | ||
nc.providers.task_processing.report_result(task["id"], error_message=str(e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should serve the purpose, no? Or did you mean with the logger module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, sometimes it's useful to output exceptions to logs, at least to debug or "info" level - so that it would be easier to diagnose problems later.
I also like "supress", a very good thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, yes logging there would be good. I was thinking along the lines that there was already an error that should be addressed, others were not relevant. Logging again doesn't hurt ✌️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for the future:
except (NextcloudException, httpx.RequestError) as e:
pass
this should catch all exceptions, I think
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
67ec0aa
to
ddea11d
Compare
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
ddea11d
to
5fc7409
Compare
No description provided.