You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose SAIC’s return code and message on exceptions #54
When a call fails, SaicApiException only keeps the combined text, "return code: 8, message: Vehicle not locked.". To act on the reason, callers have to parse that string back apart.
Why it matters: the same code can mean different things, and the message is the only way to tell them apart:
Code 8 is used both for "vehicle not locked" and for the remote command limit ("start the vehicle with the key"). They need different handling: one asks the user to lock the car, the other to drive it.
Code 4 means the car couldn't be reached, e.g. asleep. Integrations want to treat that as "unreachable" rather than as a failure.
401 / 403 mean the session has expired.
In mg-saic-ha we were parsing str(e) to tell these apart, which breaks if the wording ever changes.
Suggested change:
keep return_code and SAIC's message (saic_message) as separate attributes on SaicApiException;
add a SaicReturnCode enum for the codes with a known meaning (0, 4, 6, 8, 401, 403, and the library's own 500 for unexpected failures);
Activity
feat: keep SAIC's return code and message on every error (#55)
nanomad commentedon Oct 25, 2026
Fixed with #55