fix(zebra-print): differentiate timeout from success on network send#47
Merged
Conversation
Previously sendViaNetwork swallowed every non-refused exception and returned void, so the dialog always painted a green 'ZPL sent successfully' for both real prints AND wrong-IP timeouts — a false positive that hid failed sends. Replace the void / throw mix with a NetworkPrintResult discriminated union (responded | no_response | refused). Raw-socket printers normally never reply with HTTP, so 'no_response' is the typical success path — but the same exception is raised when the host is unreachable, and the browser cannot tell those apart. The dialog now reports 'Sent. Verify on the printer.' for that case instead of an unverified green-success. Adds the sentNoResponse locale key across all 32 languages.
There was a problem hiding this comment.
Code Review
This pull request refactors the network printing logic to handle raw-socket printers more accurately by introducing a NetworkPrintResult type and updating the UI with a new 'sentNoResponse' status. Review feedback suggests validating HTTP status codes in the responded case to avoid false positives and correcting a script inconsistency in the Serbian translation.
Reviewer-spotted (gemini-code-assist on PR #47): - A print server / proxy that responds with 4xx or 5xx was previously shown as green-success because the dialog flagged any `responded` result as success. Gate the success path on 2xx; non-2xx surfaces errorGeneric. - The sentNoResponse translation in sr.ts was emitted in Cyrillic, but the rest of the zebraPrint block in that file is Latin script. Switch to Latin for in-block consistency.
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.
No description provided.