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

Annotate panicking functions with #[track_caller] #1248

Merged
merged 2 commits into from Aug 11, 2022
Merged

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented Aug 11, 2022

This annotates panicking functions with #[track_caller] so the error message points to where the user added the invalid router, rather than somewhere internally in axum.

Before:

thread 'routing::tests::foobar' panicked at 'Invalid route "/:b": insertion failed due to conflict with previously registered route: /:a', axum/src/routing/mod.rs:174:13

After

thread 'routing::tests::foobar' panicked at 'Invalid route "/:b": insertion failed due to conflict with previously registered route: /:a', axum/src/routing/tests/mod.rs:667:10

This should make it even easier to hunt down which route actually causes the conflict.

@davidpdrsn davidpdrsn enabled auto-merge (squash) August 11, 2022 10:28
@jplatte
Copy link
Member

jplatte commented Aug 11, 2022

Your "Before" and "After" are equal 😆

@davidpdrsn
Copy link
Member Author

Whoops! Fixed 😅

@davidpdrsn davidpdrsn merged commit 6cd3566 into main Aug 11, 2022
@davidpdrsn davidpdrsn deleted the track-caller branch August 11, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants