login: wrap and propagate errors - #2
Open
Fizzadar wants to merge 1 commit into
Open
Conversation
The login goroutine's error was handed straight back to the provisioning API, which replaced it with a generic 500 M_UNKNOWN "Internal error in login step". That was doubly bad here: redditchat's status errors embed up to 500 bytes of raw response body, which local bridges surface directly to the user. redditchat distinguished SSO-only accounts, blocked browser verification and rejected credentials, but only as bare errors.New values with no exported sentinel, so none of it could be matched on. Export sentinels for those cases plus rejected OTP codes, and map them onto declared RespErrors. This also removes the substring match on "otp required" that gated the whole 2FA branch. It tested err.Error() against a message built inline at the call site, so rewording that message would have silently broken OTP login rather than failing loudly. It now uses errors.Is against the sentinel. Also use bridgev2.ErrInvalidLoginFlowID for unknown flow IDs so they 404 instead of 500.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.