Description
Raised on HTTP 400/422 responses — malformed parameters, missing required fields, or out-of-range values. Should expose field-level validation details from the API so the developer knows which parameter is wrong.
Proposed Steps
- Define
InvalidRequestError(ShadeError) in errors.py.
- Add
param: Optional[str] (the offending field name) and field_errors: dict (all field errors from API response).
- Populate from API error response format, e.g.
{"error": {"code": "invalid_param", "param": "amount", "message": "..."}}.
Acceptance Criteria
- A 400 response raises
InvalidRequestError.
error.param names the offending field when the API provides one.
error.field_errors contains all field-level errors from the API response.
str(error) includes the param name in the message.
Description
Raised on HTTP 400/422 responses — malformed parameters, missing required fields, or out-of-range values. Should expose field-level validation details from the API so the developer knows which parameter is wrong.
Proposed Steps
InvalidRequestError(ShadeError)inerrors.py.param: Optional[str](the offending field name) andfield_errors: dict(all field errors from API response).{"error": {"code": "invalid_param", "param": "amount", "message": "..."}}.Acceptance Criteria
InvalidRequestError.error.paramnames the offending field when the API provides one.error.field_errorscontains all field-level errors from the API response.str(error)includes the param name in the message.