Error thrown for SSE-specific failures (connection, protocol errors)

Example

import { createFej, FejSSEError } from 'fej';

const api = createFej();
try {
for await (const event of api.sse('/stream')) {
console.log(event.data);
}
} catch (error) {
if (error instanceof FejSSEError) {
console.error('SSE error:', error.message);
console.error('Status:', error.response?.status);
}
}

Hierarchy (view full)

Constructors

Properties

originalError?: Error
context?: FejContext
statusCode?: number
response?: Response

The HTTP response that caused the failure (for header/status inspection)