Skip to content

Distinguish pair failures by Easee's PairingResultCode title#43

Merged
martijnversluis merged 1 commit into
mainfrom
add-pairing-result-code-errors
Jul 15, 2026
Merged

Distinguish pair failures by Easee's PairingResultCode title#43
martijnversluis merged 1 commit into
mainfrom
add-pairing-result-code-errors

Conversation

@martijnversluis

Copy link
Copy Markdown
Contributor

Easee packs a family of pair rejections (IncorrectPIN, TooManyAttempts, AlreadyPairedWithPartner, AlreadyPairedWithUser, ...) under one shared HTTP 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.

Changes

  • Two new error classes: Errors::TooManyAttempts and Errors::AlreadyPaired.
  • Each pair-family error class carries its own PAIRING_RESULT_TITLES constant with the titles it maps to.
  • raise_credentials_or_request_error now branches on errorCode == 123 and picks the matching class by title. Unknown titles still fall through to RequestFailed so 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.

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
@martijnversluis
martijnversluis requested a review from Copilot July 15, 2026 09:41
@martijnversluis

Copy link
Copy Markdown
Contributor Author

@claude kan je hier meekijken?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@martijnversluis
martijnversluis merged commit 6d32763 into main Jul 15, 2026
1 of 2 checks passed
@martijnversluis
martijnversluis deleted the add-pairing-result-code-errors branch July 15, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants