Skip to content

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Oct 3, 2025

I had to fought today to find the error in rust-lang/rustup#2876 (comment), mainly because CloudWatch is really bad, but also because we didn't post any error to the user.

This PR improves the way we deal with user facing error by creating a inform! macro that wraps anyhow::bail!+UserError. This allows two things, first that we always post an error message to the user and second that we log it (correctly).

This has also the side-effect that don't return 500 when we only have user facing errors. It also reduce the boilerplate of doing ErrorComment+post()+return Ok(()) each time.

To put it in another way, let's use our the HandlerError infra the way it should be used.

@Urgau Urgau requested a review from Kobzol October 3, 2025 16:37
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of control-flow being hidden inside macros, so I'd rather do return user_error!(...);. But I'm also fine with the current version.

View changes since this review

@Urgau Urgau force-pushed the handlers-user-error branch from c5fa106 to 61d9a80 Compare October 5, 2025 13:44
@Urgau
Copy link
Member Author

Urgau commented Oct 5, 2025

Agree with you that the hidden control-flow was a bit weird. Changed to your proposed user_error! macro.

@Urgau Urgau added this pull request to the merge queue Oct 5, 2025
Merged via the queue into rust-lang:master with commit 5e11c7b Oct 5, 2025
3 checks passed
@Urgau Urgau deleted the handlers-user-error branch October 5, 2025 13:58
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.

3 participants