Skip to content

login: wrap and propagate errors - #2

Open
Fizzadar wants to merge 1 commit into
mainfrom
nick/login-error-propagation
Open

login: wrap and propagate errors#2
Fizzadar wants to merge 1 commit into
mainfrom
nick/login-error-propagation

Conversation

@Fizzadar

Copy link
Copy Markdown
Member

No description provided.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant