Skip to content

Friendly loading-error messages + rotating debug log - #9

Merged
Adron merged 1 commit into
devfrom
feature/friendly-error-messages-debug-log
Aug 3, 2026
Merged

Friendly loading-error messages + rotating debug log#9
Adron merged 1 commit into
devfrom
feature/friendly-error-messages-debug-log

Conversation

@Adron

@Adron Adron commented Aug 2, 2026

Copy link
Copy Markdown
Member

What

Loading failures were showing raw technical text from APIError (e.g. "Decoding ListRowDTO failed: keyNotFound…"). This makes the UI friendly and moves the technical detail into a retrievable debug-log file.

User-facing messages (fix at the error type)

  • APIError.errorDescription (→ localizedDescription, which every error banner already reads) now returns a new userFacingMessage — friendly copy for the client-only cases (decoding / transport / bare status codes). Server-written 4xx messages (e.g. "Email not verified") are preserved verbatim.
  • The technical string stays in .description (used only for logs). Net effect: every existing banner improves with no view-file edits.

Debug log in the app's folder

  • New AppLog (facade over os.Logger) + rotating FileLog~/Library/Containers/com.interlinedlist.macos/Data/Library/Logs/InterlinedList/interlinedlist.log (5 MB rotation, one .1 backup).
  • APIClient logs the full technical cause — request path + complete DecodingError coding path — at every decode / transport / non-2xx failure. The user only ever sees the friendly banner.

Example log line produced end-to-end:

… [ERROR] APIClient: Decode failed [/api/x] type=Greeting: DecodingError.dataCorrupted … Unexpected character 'n' around line 1, column 3 …

Testing

  • 282 InterlinedKit tests pass (7 new: user-facing/technical split, FileLog write + rotation + no-op).
  • A test-isolation guard sniffs the loaded XCTestCase runtime (SwiftPM omits XCTestConfigurationFilePath) so unit runs never write to the real ~/Library.
  • App builds (** BUILD SUCCEEDED **).

Notes

  • Retrieval is file-on-disk for now; a Help-menu "Reveal/Export Logs…" affordance can follow.
  • Covers everything through APIClient (all network/decoding errors); domain errors were already friendly.

🤖 Generated with Claude Code

Loading failures surfaced technical text straight from APIError
(e.g. "Decoding ListRowDTO failed: …"). APIError.errorDescription now
returns a new userFacingMessage — friendly copy for the client-only
cases (decoding/transport/bare status), with server-written 4xx
messages preserved verbatim. The technical form stays in .description
for logs, so every existing error banner improves with no view edits.

Adds AppLog (facade over os.Logger) + a rotating FileLog that writes
to Library/Logs/InterlinedList/interlinedlist.log inside the app
container. APIClient logs the full technical cause — request path plus
the complete DecodingError coding path — at each decode/transport/
non-2xx failure; the user only ever sees the friendly banner.

Tests: APIError user-facing vs. technical split, FileLog write +
rotation, and a test-isolation guard so unit runs never touch the
real ~/Library.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Adron
Adron merged commit 6bda0cc into dev Aug 3, 2026
4 of 8 checks passed
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.

1 participant