Extend friendly API errors to 409 conflict + 422 validation (#123) #163
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/123-extend-friendly-errors-409-422"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#123 was resolved by #142, which gave 401/403/404/429 a short human-readable headline and pushed the raw
/api/v1URL down to thecaused by:source. This extends that treatment to the two client-error classes #142 left as raw dumps.Before, 409 and 422 still led with the internal URL because
friendly_http_errorreturnedNonefor them:What
friendly_http_errornow handlesCONFLICT(409) andUNPROCESSABLE_ENTITY(422). For these, the server's own message is the actionable detail (a conflict reason, a validation error), so the headline surfaces that instead of the URL:conflict: o/r: The branch already exists./invalid request: o/r: head and base are the same. The message is length-capped viatruncate_previewso a verbose validation body can't blow up the headline. The fullApiError(with the URL) stays as the--debug/FJ_DEBUG=1caused by:source, same as the other classes.1. They are request problems, not the not-found / auth / transient classes that carry 3/4/5, so a script can't meaningfully branch on them the way it does for those.maps_4xxtests;docs/exit-codes.mdupdated to list 409/422 and note they stay exit1.Resolves the remaining gap in #123.
cargo fmt --check,cargo clippy --all-targets, and the full test suite pass locally./api/v1URL and every failure exits 1, so scripts cannot branch on failure kind #123