Skip to main content

HTTP Error Handling

Subscribe to onSseError to react to HTTP failures returned from the bot provider. Combine with the isHttpError helper from @asgard-js/core to safely inspect the status code.

HTTP 429 Rate Limit

Click the button below to simulate onSseError receiving an HTTP 429. The handler calls isHttpError() to detect the error type, then shows a toast notification. The code block below shows the actual wiring.

Code Example

import { isHttpError } from "@asgard-js/core";

<Chatbot
onSseError={(error) => {
if (isHttpError(error) && error.status === 429) {
toast.warning("Rate limit reached, please try again later");
}
}}
{...rest}
/>;