Distinguish pair failures by Easee's PairingResultCode title#43
Merged
Conversation
Easee packs a family of pair rejections (IncorrectPIN, TooManyAttempts, AlreadyPairedWithPartner/User, ...) under one shared errorCode 123 and puts the specific reason in the response body's `title` field, following their PairingResultCode enumeration. Before this change the client only looked at `errorCode`, so every one of those failures collapsed into a generic RequestFailed. Consumers of the gem had no way to tell a wrong PIN apart from a 24-hour lockout or a charger that was already paired to someone else. This adds TooManyAttempts and AlreadyPaired error classes and teaches the client to pick the right one based on the title when errorCode is 123. An unknown title still falls through to the generic RequestFailed. https://developer.easee.com/docs/enumerations
Contributor
Author
|
@claude kan je hier meekijken? |
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.
Easee packs a family of pair rejections (
IncorrectPIN,TooManyAttempts,AlreadyPairedWithPartner,AlreadyPairedWithUser, ...) under one shared HTTPerrorCode: 123and puts the specific reason in the response body'stitlefield, following their PairingResultCode enumeration.Before this change the client only looked at
errorCode, so every one of those failures collapsed into a genericRequestFailed. Consumers of the gem had no way to tell a wrong PIN apart from a 24-hour lockout or a charger that was already paired to someone else.Changes
Errors::TooManyAttemptsandErrors::AlreadyPaired.PAIRING_RESULT_TITLESconstant with the titles it maps to.raise_credentials_or_request_errornow branches onerrorCode == 123and picks the matching class by title. Unknown titles still fall through toRequestFailedso callers keep a safe default.Consumer impact
The existing 193 mapping (
InvalidPinCode) is untouched, so current consumers keep behaving as before. StekkerWeb will bump the gem in a follow-up PR to render dedicated UI messages for the new error classes.