From bfcb6b37d8813c0c047e32ea8ef6414067588aee Mon Sep 17 00:00:00 2001 From: mrousavy Date: Sun, 7 Mar 2021 14:26:21 +0100 Subject: [PATCH] Add a few TypeDoc annotations for CameraError --- src/CameraError.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CameraError.ts b/src/CameraError.ts index d70b621..6222d1e 100644 --- a/src/CameraError.ts +++ b/src/CameraError.ts @@ -104,6 +104,9 @@ class CameraError extends Error { return this._cause; } + /** + * @internal + */ constructor(code: TCode, message: string, cause?: ErrorWithCause) { super(`[${code}]: ${message}${cause ? ` (Cause: ${cause.message})` : ''}`); this._code = code; @@ -124,6 +127,11 @@ export class CameraRuntimeError extends CameraError< PermissionError | ParameterError | DeviceError | FormatError | SessionError | SystemError | UnknownError > {} +/** + * Checks if the given `error` is of type `ErrorWithCause` + * @param error Any unknown object to validate + * @returns `true` if the given `error` is of type `ErrorWithCause` + */ export const isErrorWithCause = (error: unknown): error is ErrorWithCause => typeof error === 'object' && error != null &&