You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In fetch_resource and elsewhere, errors are handled in a pretty negligent way - a line is logged and None is returned, and things carry on...
But this does not allow the calling script to inspect what kind of error was encountered and what it needs to do to remedy / retry the failed fetch / search / whatever.
I think several things need to be improved:
Look at the best way to model either Error objects or using Python exceptions, based on the error message like
{"timestamp":"2025-01-30T00:31:17.885+00:00",
"status":500,
"error":"Internal Server Error",
"message":"Unexpected error of some kind....",
"path":"/server/api/discover/search/objects"}
Architecturally, change fetch_resource and all the calling functions to stop catching+logging, but either returning these Error objects somehow or raising new Exceptions based on the error thrown by fetch_resource so the caller can handle them
This would be a breaking change as most existing scripts using the library would be used to testing for None returns and reading log messages for error handling
The text was updated successfully, but these errors were encountered:
@pnbecker suggested parallel methods to avoid breaking changes, if that is still a problem (it may not be - see notes of fetch_resource usage at #47).
Another way could be an optional parameter to all those methods like handle_errors=False, so the same methods can be used but callers can specifically turn ON the error handling.
In
fetch_resource
and elsewhere, errors are handled in a pretty negligent way - a line is logged and None is returned, and things carry on...But this does not allow the calling script to inspect what kind of error was encountered and what it needs to do to remedy / retry the failed fetch / search / whatever.
I think several things need to be improved:
This would be a breaking change as most existing scripts using the library would be used to testing for None returns and reading log messages for error handling
The text was updated successfully, but these errors were encountered: