Move to websocket for requests to signal server
This commit is contained in:
parent
8449f343a6
commit
1c1d0e2da0
31 changed files with 1892 additions and 1336 deletions
|
@ -13,6 +13,40 @@ function appendStack(newError: Error, originalError: Error) {
|
|||
newError.stack += `\nOriginal stack:\n${originalError.stack}`;
|
||||
}
|
||||
|
||||
export type HTTPErrorHeadersType = {
|
||||
[name: string]: string | ReadonlyArray<string>;
|
||||
};
|
||||
|
||||
export class HTTPError extends Error {
|
||||
public readonly name = 'HTTPError';
|
||||
|
||||
public readonly code: number;
|
||||
|
||||
public readonly responseHeaders: HTTPErrorHeadersType;
|
||||
|
||||
public readonly response: unknown;
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
options: {
|
||||
code: number;
|
||||
headers: HTTPErrorHeadersType;
|
||||
response?: unknown;
|
||||
stack?: string;
|
||||
}
|
||||
) {
|
||||
super(`${message}; code: ${options.code}`);
|
||||
|
||||
const { code: providedCode, headers, response, stack } = options;
|
||||
|
||||
this.code = providedCode > 999 || providedCode < 100 ? -1 : providedCode;
|
||||
this.responseHeaders = headers;
|
||||
|
||||
this.stack += `\nOriginal stack:\n${stack}`;
|
||||
this.response = response;
|
||||
}
|
||||
}
|
||||
|
||||
export class ReplayableError extends Error {
|
||||
name: string;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue