Clearer API error logging + branded base URL (v0.1.12)#1
Merged
Conversation
Extract formatApiError as a testable pure method in PushFireLogger, add logger unit tests, tighten existing API client test assertions (originalError, 5xx message/code, positive server-message check, relaxed non-JSON match), add timeout-seconds config test, and add subscriber logout tests verifying local data is cleared on both PushFireApiException and unexpected error paths.
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.
Summary
Released as v0.1.12. Two themes:
baseUrlswitched from the raw Supabase functions URL tohttps://api.pushfire.app/functions/v1/(same endpoint; keeps the backend project ref out of the SDK and logs).What changed
API client (
lib/src/api/pushfire_api_client.dart)PushFireApiExceptions now propagate untouched — a non-2xx response preservesstatusCode,code, andresponseBody(previously re-wrapped into a generic exception withstatusCode == null).PushFireNetworkException, "timed out after Ns") instead of "Unexpected error".PushFireLogger.logApiError, e.g.API error: PATCH update-subscriber -> HTTP 401 code=missing_auth msg="Missing authorization header".Logging hygiene (4 services + impl)
'X failed'lines that fired at every layer for a single failure.error→warning.Deliberate non-changes (decided during design)
enableLogging(defaultfalse); failures are silent unless logging is enabled (they still surface via the thrown exception).Testing
test/api/pushfire_api_client_test.dart(8 tests): structured-error preservation, the "not re-wrapped" regression, 5xx, non-JSON body fallback,SocketException, and timeout — viaMockClient(no new deps).flutter analyzeclean.Notes
sb-project-ref); the error change preserves more info. No public API signature changes.docs/superpowers/{specs,plans}/2026-06-22-sdk-error-logging*.🤖 Generated with Claude Code