Skip to content
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

Improve error handling around CLI api commands #3519

Merged
merged 3 commits into from
Aug 19, 2024

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Aug 19, 2024

Adds context management capability around Nominatim[Async]API objects, so that it becomes easier to properly close the connection. Without closing properly, there are sometimes odd errors around lingering database connections or unhandled exceptions. The new with construct is used in tests and in the CLI tool.

Also adds translation from nominatim_api.UsageError to nominatim_db.UsageError in the CLI tool. The latter suppresses the Python tracebacks for these errors.

If close() isn't properly called, it can lead to odd error messages
about uncaught exceptions.
UsageErrors are handled specially and don't show backtraces
unless explicitly requested. We want the same behaviour for
errors coming from the API functions.
@lonvia lonvia merged commit 968f1cd into osm-search:master Aug 19, 2024
11 checks passed
@lonvia lonvia deleted the api-error-handling branch August 19, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant