SSE Session and examples
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
/**
|
||||
* Error thrown when a response body is null
|
||||
*/
|
||||
export class ResponseBodyNullError extends Error {
|
||||
constructor() {
|
||||
super('Response body is null');
|
||||
this.name = 'ResponseBodyNullError';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error thrown when an HTTP error occurs
|
||||
*/
|
||||
export class HTTPError extends Error {
|
||||
constructor(status: number, message: string) {
|
||||
super(`HTTP error! Status: ${status} - ${message}`);
|
||||
this.name = 'HTTPError';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error thrown when a plugin's unsubscribe function is not a function
|
||||
*/
|
||||
export class SSESessionUnsubscribePluginNotAFunctionError extends Error {
|
||||
constructor(pluginName: string) {
|
||||
super(`${pluginName}'s unsubscribe function is not a function`);
|
||||
this.name = 'SSESessionUnsubscribePluginNotAFunctionError';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user