HTTP Error
ngx-prompt-kit original — not part of ibelick/prompt-kit
describeHttpError() maps any thrown value to a friendly, user-facing message — HttpErrorResponse by status, with RFC 7807 problem-details and raw-message fallbacks. Pass overrides to customise the copy per status.
Examples
Status → message
The built-in defaults for the statuses chat apps care about. Each row is describeHttpError(new HttpErrorResponse({ status })).
0Network error. Check your connection and try again.
401Your session expired. Sign in again to continue.
403Out of credits or not authorized for this action.
429Rate limited. Please wait a moment and retry.
503The server hit an error. Try again in a moment.
import { describeHttpError } from 'ngx-prompt-kit/http-error';
catch (err) {
this.error.set(describeHttpError(err));
}Per-status override
Pass an overrides object to replace any default. Here 402/403 becomes an upgrade prompt.
Upgrade your plan to use this model.
describeHttpError(err, {
forbidden: 'Upgrade your plan to use this model.',
});Installation
Add the describeHttpError() utility to your project.
ng generate ngx-prompt-kit:http-error