Override CameraError toString

This commit is contained in:
Marc Rousavy 2021-03-31 16:01:46 +02:00
parent 7c33839e36
commit e02c051e19

View File

@ -116,11 +116,17 @@ class CameraError<TCode extends CameraErrorCode> extends Error {
* @internal
*/
constructor(code: TCode, message: string, cause?: ErrorWithCause) {
super(`[${code}]: ${message}${cause ? ` (Cause: ${cause.message})` : ''}`);
super(`[${code}]: ${message}${cause != null ? ` (Cause: ${cause.message})` : ''}`);
super.name = code;
super.message = message;
this._code = code;
this._message = message;
this._cause = cause;
}
public toString(): string {
return `[${this.code}]: ${this.message}`;
}
}
/**