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

move security error handling to use ctx macro #658

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

svix-gabriel
Copy link
Contributor

@svix-gabriel svix-gabriel commented Sep 29, 2022

We recently added a ctx! macro to help make handling and tracing internal server errors much more straightforward. This PR adds ctx! invocations in security.rs to a couple of common errors that were being manually transformed.

This also let us axe the to_internal_server_error function. to_internal_server_error was logging errors, but this was redundant with error::Error's logging in error.rs (when it gets turned into a response for axum).

Motivation

  • Cut down boilerplate in security.rs
  • Add line tracing information to the internal server errors in security.rs

Solution

  • Use the ctx! macro in security.rs
  • Implement Traceable for the *Rejection types to make ctx! work

@svix-gabriel svix-gabriel marked this pull request as ready for review September 29, 2022 18:10
@svix-gabriel svix-gabriel merged commit e65bbbf into main Sep 29, 2022
@svix-gabriel svix-gabriel deleted the gabriel/move-security-errors-to-use-ctx branch September 29, 2022 18:31
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.

None yet

2 participants