2 min read
Clamp before calling
The engine bounds the Business Loan to £50–£500 and 14–84 days. Constrain your inputs — slider min/max, number-field bounds — so a user cannot request a figure that will 422 in the first place. Prevention beats handling.
Read the detail on a 422
If a value still slips through (a pasted number, an API caller), the endpoint returns a 422 whose detail states the bound it enforced. Parse that, clamp to the nearest valid value, and either retry automatically or prompt the user — do not show the raw error body.
Message like a human
Replace the machine error with plain guidance: 'Enter an amount between £50 and £500' rather than 'HTTP 422 out_of_range'. Branch on the machine code, not the message text. See the quote-widget recipe for the full control.
Frequently asked questions
What are the exact quote bounds?
£50 to £500 for the amount and 14 to 84 days for the term, on the Business Loan. Values outside those return a 422 whose detail states the bound.
Should I auto-clamp or prompt the user?
Either is fine — auto-clamp to the nearest valid value for a smooth slider, or prompt with a friendly message for a typed field. What you should not do is surface the raw 422 to the user.
Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.
