2020-09-28 21:54:44 +02:00
|
|
|
class InvalidOperationError extends Error {
|
2021-04-20 12:32:02 +02:00
|
|
|
constructor(message: string) {
|
2020-09-28 21:54:44 +02:00
|
|
|
super();
|
|
|
|
Error.captureStackTrace(this, this.constructor);
|
|
|
|
|
|
|
|
this.name = this.constructor.name;
|
|
|
|
this.message = message;
|
|
|
|
}
|
|
|
|
|
2021-04-20 12:32:02 +02:00
|
|
|
toJSON(): object {
|
|
|
|
return {
|
2020-09-28 21:54:44 +02:00
|
|
|
isJoi: true,
|
|
|
|
name: this.constructor.name,
|
|
|
|
details: [
|
|
|
|
{
|
|
|
|
message: this.message,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2021-04-20 12:32:02 +02:00
|
|
|
export default InvalidOperationError;
|
2020-09-28 21:54:44 +02:00
|
|
|
module.exports = InvalidOperationError;
|