@felixgeelhaar/govee-api-client
Version:
Enterprise-grade TypeScript client library for the Govee Developer REST API
28 lines • 807 B
JavaScript
export class GoveeApiClientError extends Error {
constructor(message, cause) {
super(message);
this.name = this.constructor.name;
this.timestamp = new Date();
this.cause = cause;
Error.captureStackTrace(this, this.constructor);
}
toObject() {
const obj = {
name: this.name,
code: this.code,
message: this.message,
timestamp: this.timestamp.toISOString(),
};
if (this.stack !== undefined) {
obj.stack = this.stack;
}
if (this.cause !== undefined) {
obj.cause = this.cause;
}
return obj;
}
toString() {
return `${this.name} [${this.code}]: ${this.message}`;
}
}
//# sourceMappingURL=GoveeApiClientError.js.map