Repository navigation
fix(menu): readable API errors, no false Offline, full long-break range - #17
Merged
Merged
Conversation
…r N.'
APIError lacked LocalizedError, so every settings footer rendered the
NSError bridge ('The operation couldn't be completed. (EmberKit.APIError
error 0.)') instead of the server's message. Enabling Pomodoro against a
pre-v0.5.0 server failed with exactly that string, hiding the actual
cause ('pomodoro feature is not enabled', HTTP 404). Map each case to
readable text, extract the server's {"error":…} field when present, and
show the underlying error in the Pomodoro tab's load-failure caption.
AppModel.refresh() awaited /state and both pomodoro endpoints in one try, so the 404 those endpoints return while the feature is disabled marked the whole app disconnected and blanked the dashboard even though /state was healthy. Only the /state fetch now decides connectedness; pomodoro state/stats degrade to nil on their own.
validatePomodoro accepts long_break_minutes up to 180 but the stepper capped input at 120, making 121–180 (reachable via config.json) sticky: any other edit couldn't be saved without first lowering the value.
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.
What
Three menu-app fixes that fell out of debugging "Save failed: The operation couldn't be completed. (EmberKit.APIError error 0.)" on the Pomodoro tab:
APIErrornow conforms toLocalizedError. The old message was the raw NSError bridge; the actual cause (HTTP 404pomodoro feature is not enabledfrom a pre-v0.5.0 server) was invisible. Error text now shows the server's{\"error\":…}field when present, plus a clearer Pomodoro-tab load-failure caption.AppModel.refresh()awaited/state+ pomodoro state/stats in onetry, so the 404s those endpoints return while Pomodoro is disabled blanked the dashboard and showed Offline despite a healthy server. Connectedness is now decided by/statealone; pomodoro fields degrade tonil.validatePomodoroallows 180, making 121–180 (set via config.json) sticky in the UI.Why the original error happened
The running container is still v0.4.0 (
6ad0339), which gatesPUT /v1/pomodoro/configbehind the enabled flag — the 0.5.0 app's Enable toggle can't work against it. Fix is a redeploy todtarakanov/ember:0.5.0(image already published); these changes make the failure self-explanatory if it ever recurs.Testing
APIErrorDescriptionTests(5 cases) +refreshStaysConnectedWhenPomodoroDisabled.swift test: 78/78 pass. App target builds (xcodebuild -scheme Ember).