Repository navigation
Handle LetterXpress validation errors and require national shipping for registered mail - #90
Merged
Merged
Conversation
…or registered mail - Parse object- and array-valued "message"/"error" fields in LetterXpress error bodies (flattened to "field: message", joined with "; "); parsing never throws - Always surface API rejections as LetterXpressException with status code, including HTTP 200 responses with an application-level error and an object-valued message - Reject registered mail unless shipping is National (Auto is rejected by the API too); apply the same check in UpdatePrintJobAsync when both values are set - Update XML docs, LetterXpress docs page, regenerated API docs and CHANGELOG
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
message(field name → array of messages), e.g.{"status":400,"message":{"letter.registered":["The letter.registered field is prohibited when letter.specification.shipping is auto."]}}.TryParseErrorDetailcalledGetString()on it, so the client threwInvalidOperationExceptioninstead ofLetterXpressException, losing status code and reason. Object messages are now flattened tofield: message(joined with;), arrays are joined, anything else falls back to the raw body. Parsing never throws.Failed to deserialize LetterXpress response., no status code).LxResponse.Messageis no longer mapped; the message is read via the error helper.ShippingType.National. LetterXpress rejects it forAuto(the default) as well asInternational; the client throwsArgumentExceptionbefore sending and never switches the shipping type implicitly.UpdatePrintJobAsyncapplies the check when an update sets bothRegisteredandShipping.Tests
errorinstead ofmessage, non-JSON, empty body, JSON without both fields, undecodable strings; client: HTTP 400 validation error →LetterXpressExceptionwith status 400 and flattened message, body-level validation error, registered + Auto/default/International validation). Green on net10.0 locally, CI covers net8.0/net9.0.