Log server errors on the public API 500 paths (wire tracing in the api crate) #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The public API handlers (
crates/api/src/public.rs) map db errors to500via.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)/Err(_) => INTERNAL_SERVER_ERROR, discarding the underlyingsqlx::Error. A 500 with no trace makes production debugging hard. Theapicrate currently has notracingdependency (theservercrate does).What to do
tracingto theapicrate.list_objectsandget_object(and future handlers).References
crates/api/src/public.rs—list_objects,get_objectScope note from the admin-CRUD work (merged
main@c4e0c4c): the new admin handlers follow the same pattern as the public surface —.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)with the underlying error discarded and no tracing. This affectscrates/api/src/admin_objects.rs,admin_vocab.rs, andadmin_authorities.rs. When wiring tracing, cover the wholeapicrate's 500 paths, not just the public endpoints.