Skip to content

login: wrap and propagate errors - #60

Merged
Fizzadar merged 3 commits into
mainfrom
nick/login-error-propagation
Sep 1, 2026
Merged

login: wrap and propagate errors#60
Fizzadar merged 3 commits into
mainfrom
nick/login-error-propagation

Conversation

@Fizzadar

Copy link
Copy Markdown
Member

No description provided.

Comment thread pkg/connector/loginerrors.go Outdated
Comment thread pkg/connector/loginerrors.go Outdated
@tulir

tulir commented Aug 12, 2026

Copy link
Copy Markdown
Member

oh bridgev2's RespError wrapper is missing WithInternalError 🙃 needs to be added in mautrix-go

Fizzadar and others added 3 commits September 1, 2026 16:27
Expired or invalid cookies are the entire failure surface of a cookie login,
and linkedingo already models one case as ErrTokenInvalidated, but the login
flow wrapped everything in a plain fmt.Errorf. The provisioning API then
replaced it with a generic 500 M_UNKNOWN "Internal error in login step", so
"your cookies expired, export fresh ones" reached the user as an internal
error.

Most bad-cookie failures actually surface as a non-2xx status rather than
ErrTokenInvalidated, and that was an untyped fmt.Errorf carrying only a
formatted message. Add a typed linkedingo.ResponseError so callers can branch
on the status code, then map both it and ErrTokenInvalidated onto declared
RespErrors, including LinkedIn's 999 bot-block status.

Also use bridgev2.ErrInvalidLoginFlowID for unknown flow IDs so they 404
instead of 500.
Co-authored-by: Tulir Asokan <tulir@maunium.net>
@Fizzadar
Fizzadar force-pushed the nick/login-error-propagation branch from a1cac85 to 3e8c710 Compare September 1, 2026 15:29
@Fizzadar
Fizzadar merged commit a289af4 into main Sep 1, 2026
15 checks passed
@Fizzadar
Fizzadar deleted the nick/login-error-propagation branch September 1, 2026 15:30
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.

2 participants