diff --git a/src/types/errors/InvalidJsonError.ts b/src/types/errors/InvalidJsonError.ts new file mode 100644 index 0000000..f59339a --- /dev/null +++ b/src/types/errors/InvalidJsonError.ts @@ -0,0 +1,7 @@ +export class InvalidJsonError extends Error { + constructor() { + super('Error: invalid Json string') + this.name = 'InvalidJsonError' + Object.setPrototypeOf(this, InvalidJsonError.prototype) + } +} diff --git a/src/types/errors/JsonParseArrayError.ts b/src/types/errors/JsonParseArrayError.ts new file mode 100644 index 0000000..9006f64 --- /dev/null +++ b/src/types/errors/JsonParseArrayError.ts @@ -0,0 +1,7 @@ +export class JsonParseArrayError extends Error { + constructor(public message: string) { + super(message) + this.name = 'JsonParseArrayError' + Object.setPrototypeOf(this, JsonParseArrayError.prototype) + } +} diff --git a/src/types/errors/WeboutResponseError.ts b/src/types/errors/WeboutResponseError.ts new file mode 100644 index 0000000..9ca1e80 --- /dev/null +++ b/src/types/errors/WeboutResponseError.ts @@ -0,0 +1,7 @@ +export class WeboutResponseError extends Error { + constructor(public url: string) { + super(`Error: error while parsing response from ${url}`) + this.name = 'WeboutResponseError' + Object.setPrototypeOf(this, WeboutResponseError.prototype) + } +} diff --git a/src/types/errors/index.ts b/src/types/errors/index.ts index cca1a97..e2b0766 100644 --- a/src/types/errors/index.ts +++ b/src/types/errors/index.ts @@ -8,3 +8,6 @@ export * from './NotFoundError' export * from './ErrorResponse' export * from './NoSessionStateError' export * from './RootFolderNotFoundError' +export * from './JsonParseArrayError' +export * from './WeboutResponseError' +export * from './InvalidJsonError'