Repository navigation
connector: map errors to message statuses, resperrors and bridge states - #274
Merged
Merged
Conversation
|
All clear! No issues remaining. 🎉 2 issues already resolved
All CI checks passed on
Select any unchecked box below to run or rerun that agent. Full resultsIndent Review Agent
|
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.
LINE failures mostly reached users as raw Go errors: most Matrix handlers returned bare LINE/HTTP errors (shown as generic retriable failures), group creation and several QR login steps failed as bare 500s, a login RespError used HTTP 429 (which clients retry automatically), and two bridge states put raw error text in
Message. The SSE loop also never reported a dropped stream, so the login stayedCONNECTEDthrough LINE outages and network loss.Library errors
*line.HTTPError{StatusCode}, withline.HTTPStatusCode(err)to read it, so callers can tell rate limits, server errors and rejections apart. Error strings are unchanged, so the existing string-based auth/TalkException classifiers keep working.http.NewRequestWithContext(c.requestContext(), ...)), like the Talk RPCs already were.line.IsTalkException(err)for "LINE rejected this call" responses.Sends (message statuses)
wrapSendErrorused byHandleMatrixMessage,HandleMatrixMessageRemove,HandleMatrixReaction,HandleMatrixReactionRemove,HandleMatrixLeaveRoom,HandleMatrixAcceptMessageRequest,HandleMatrixDeleteChatandHandleMatrixBlockUser. Errors that already carry aMessageStatuspass through unchanged. Otherwise:NoPermission,FAIL, certainNetworkError, certainNetworkError, left uncertainNetworkError, certainNoPermission+FAILwith a human message instead of the raw error text as a generic retriable failure.bridgev2.ErrMediaDownloadFailed, HEIC conversion failuresErrMediaConvertFailed, and unsupported msgtypesErrUnsupportedMessageType.ErrMediaTooLarge, auth failures throughwrapSendError, and everything else toErrMediaReuploadFailed(certain).wrapConvertErrorthat marks them certain.wrapSendError.sendMessagesucceeds. If that upload fails, the status is nowFAIL, uncertain, "the message was sent to LINE, but the attachment failed to upload", rather than a retriable error that would post the message again.Unsupported+FAIL.Login and provisioning (RespErrors)
StartQRLogin,VerifyQRCertificate,CreatePinCodeandQRCodeLoginV2, and the post-login profile check infinishLogin("failed to verify token"), now go through the existingwrapLineLoginErrorinstead of reaching clients as bare 500s.ErrLoginTooManyAttemptsnow uses status 400 instead of 429, so clients don't silently retry the login.ErrLoginUnknownis built frommautrix.MUnknown.wrapLineRespErrorforCreateGroup. It returnsfmt.Errorf("%w: %w", mapped, err):M_FORBIDDENM_FORBIDDEN; TalkException "not found" →M_NOT_FOUNDM_LIMIT_EXCEEDEDwith status 400M_FORBIDDEN"LINE rejected the request"M_UNKNOWNBridge states
line-login-failedandline-token-expiredno longer put the raw error inMessage; it moved toInfo["go_error"], and human messages are registered instatus.BridgeStateHumanErrors.RELOGINstays explicit because the pinned mautrix-go predates the framework default.TRANSIENT_DISCONNECTline-sse-disconnectedonce, andCONNECTEDagain on the first event after the stream comes back. The existing reconnect loop is unchanged.Not changed: a pre-upload media size check (LINE's limit isn't known from the code). This doesn't conflict with #271; a trial merge of its head is clean.
bridgelint is clean (
bridgelint -verbose ./...exits 0 with no findings; before: 19 errors, 16 warnings, 1 info).go build ./...,go vetandstaticcheck(excluding generatedpkg/ltsm) are clean, and the existingpkg/connectorandpkg/linetests pass. One existing test was updated because the reaction-specific not-a-member helper was folded into the shared mapper.Tag
@indentto continue the conversation here.