-
Notifications
You must be signed in to change notification settings - Fork 210
Open
Labels
A-backendArea: Webserver backendArea: Webserver backendE-easyEffort: Should be easy to implement and would make a good first PREffort: Should be easy to implement and would make a good first PRP-lowLow priority issuesLow priority issuesmentorThis has instructions for getting startedThis has instructions for getting started
Description
We are using the crates.io search API to power our own crate-search.
Sometimes the crates.io API returns 4xx or 5xx errors because of wrong queries or timeouts.
These errors can be shown to the user, but there is no need to report them to sentry or log them as errors.
We could add a new metric to track the amount of errors.
Metadata
Metadata
Assignees
Labels
A-backendArea: Webserver backendArea: Webserver backendE-easyEffort: Should be easy to implement and would make a good first PREffort: Should be easy to implement and would make a good first PRP-lowLow priority issuesLow priority issuesmentorThis has instructions for getting startedThis has instructions for getting started
Activity
syphar commentedon Apr 4, 2024
instructions:
web::releases::get_search_results
fetches the search results, it's used inweb::releases::search_handler
tracing::error!
to sentry, and also every server errorbyfnoel commentedon Sep 4, 2024
@rustbot claim
Display crates.io search errors instead of logging them
byfnoel commentedon May 20, 2025
cc: @syphar, @GuillaumeGomez
After a second take, I believe the
?
bubble up errors that eventually convert toAxumNope::InternalError
, which reports to Sentry and also logs as errors.I was thinking of creating a custom error response based on how it is constructed in
registry_api.rs
.See:
My propose solution (This goes inside
src/web/releases.rs
):syphar commentedon May 22, 2025
@byfnoel thank you for working on this!
generally: differentating between error types should never be done via text matching.
The cleanest way would be to introduce a new error type (
enum
withthiserror
), that is returned byget_search_result
which would enable us to differentiate between a crates.io-error and the other errors. Then you could also have the crates.io error variant contain a nice error message with whatever is coming from the crates.io API.byfnoel commentedon May 23, 2025
Thank you @syphar.
Your suggestion makes sense.