mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-09-15 13:32:28 +00:00
15 lines
458 B
TypeScript
15 lines
458 B
TypeScript
export class ApiError {
|
|
|
|
public statusCode: number;
|
|
public jsonResponse: any;
|
|
|
|
constructor(statusCode: number, json: any) {
|
|
// Because typescript is just plain dumb
|
|
// https://stackoverflow.com/questions/31626231/custom-error-class-in-typescript
|
|
Error.apply(this, ["ApiError"]);
|
|
|
|
if (typeof(json) === "string") json = {message: json};
|
|
this.jsonResponse = json;
|
|
this.statusCode = statusCode;
|
|
}
|
|
} |