Repository navigation
feat(exception)!: keep error details and contain request failures - #126
Conversation
Power labels match case-insensitively. All Light primitives are boxed and nullable, so one null no longer fails listLights for every light, and seconds_since_seen keeps its fraction. Undocumented status and power values still fail the response: enums hold only documented values. BREAKING CHANGE: Light accessors return Boolean, Double or Integer and may return null; missing fields are null instead of 0 or false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LifxErrorException keeps the status code, raw body and X-RateLimit-* data (LifxRateLimit), and its message includes the status code. Retry on 429 is still out of scope. *Input constructors and LightsState reject null values when built, and LifxClientImpl rejects a null input, instead of an NPE from a log line. A failing call.request() now yields a Failure, with no URL in the message. BREAKING CHANGE: the LifxErrorException constructor takes the status code, error model, raw body and rate limit. Null inputs and input components throw NullPointerException. SetLightsStatesInput copies its list. The exception message format changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
de2675c to
4875027
Compare
Code coverage
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
By owner decision, Light goes back to primitive fields. A null primitive fails the response again, and seconds_since_seen is truncated to an int. Tests pin both behaviors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Makes failed calls easier to diagnose, accepts power labels in any case, and stops null arguments and request-building failures from surfacing as stray exceptions.
Changes
Error details.
LifxErrorExceptionnow keeps the status code, the raw error body and theX-RateLimit-*data (newLifxRateLimitrecord). A malformed rate-limit header gives a null component and never fails. The exception message now includes the status code; the raw body stays out of it. There is still no retry on 429: callers can usereset()on the rate limit, after checking for null.Deserialization. Power labels match case-insensitively.
Null and request failures.
*Inputconstructors andLightsStatereject null values when built, andLifxClientImplrejects a null input, instead of an NPE from an operation's log line. Ifcall.request()throws, the caller now gets aFailurewhose message readsCall <unknown request> failed with cause ....Decisions
Lightkeeps native types, so a null primitive still fails the whole response, andseconds_since_seenis anint, so a fractional value is truncated. Tests pin both.statusor power label still fails the whole response. Enums hold only documented values, so there is noUNKNOWNconstant.NullPointerExceptionrather than returningFailure, since they are programmer errors. The README andLifxResultJavadoc are amended accordingly.Breaking changes
LifxErrorExceptionconstructor takes the status code, error model, raw body and rate limit, and its message format changed.NullPointerException.SetLightsStatesInputcopies its list and rejects null elements.Testing
./gradlew checkpasses (166 JUnit tests, 25 Spock specs), andmarkdownlint-cli2is clean. New tests cover the error details end to end over WireMock for every operation, null components of every input, null input on every client method, andcall.request()throwing.integrationTestwas not run, because it switches a real light.🤖 Generated with Claude Code