Use @linkcode for typedocs
This commit is contained in:
@@ -37,7 +37,7 @@ export type SystemError = 'system/no-camera-manager';
|
||||
export type UnknownError = 'unknown/unknown';
|
||||
|
||||
/**
|
||||
* Represents a JSON-style error cause. This contains native `NSError`/`Throwable` information, and can have recursive {@link ErrorWithCause.cause} properties until the ultimate cause has been found.
|
||||
* Represents a JSON-style error cause. This contains native `NSError`/`Throwable` information, and can have recursive {@linkcode ErrorWithCause.cause | .cause} properties until the ultimate cause has been found.
|
||||
*/
|
||||
export interface ErrorWithCause {
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ export interface ErrorWithCause {
|
||||
type CameraErrorCode = PermissionError | ParameterError | DeviceError | FormatError | SessionError | CaptureError | SystemError | UnknownError;
|
||||
|
||||
/**
|
||||
* Represents any kind of error that occured in the {@link Camera} View Module.
|
||||
* Represents any kind of error that occured in the {@linkcode Camera} View Module.
|
||||
*/
|
||||
class CameraError<TCode extends CameraErrorCode> extends Error {
|
||||
private readonly _code: TCode;
|
||||
@@ -117,20 +117,24 @@ class CameraError<TCode extends CameraErrorCode> extends Error {
|
||||
|
||||
/**
|
||||
* Represents any kind of error that occured while trying to capture a video or photo.
|
||||
*
|
||||
* See the ["Camera Errors" documentation](https://cuvent.github.io/react-native-vision-camera/docs/errors) for more information about Camera Errors.
|
||||
*/
|
||||
export class CameraCaptureError extends CameraError<CaptureError> {}
|
||||
|
||||
/**
|
||||
* Represents any kind of error that occured in the Camera View Module.
|
||||
*
|
||||
* See the ["Camera Errors" documentation](https://cuvent.github.io/react-native-vision-camera/docs/errors) for more information about Camera Errors.
|
||||
*/
|
||||
export class CameraRuntimeError extends CameraError<
|
||||
PermissionError | ParameterError | DeviceError | FormatError | SessionError | SystemError | UnknownError
|
||||
> {}
|
||||
|
||||
/**
|
||||
* Checks if the given `error` is of type {@link ErrorWithCause}
|
||||
* Checks if the given `error` is of type {@linkcode ErrorWithCause}
|
||||
* @param {unknown} error Any unknown object to validate
|
||||
* @returns `true` if the given `error` is of type {@link ErrorWithCause}
|
||||
* @returns `true` if the given `error` is of type {@linkcode ErrorWithCause}
|
||||
*/
|
||||
export const isErrorWithCause = (error: unknown): error is ErrorWithCause =>
|
||||
typeof error === 'object' &&
|
||||
@@ -155,7 +159,7 @@ const isCameraErrorJson = (error: unknown): error is { code: string; message: st
|
||||
/**
|
||||
* Tries to parse an error coming from native to a typed JS camera error.
|
||||
* @param {CameraError} nativeError The native error instance. This is a JSON in the legacy native module architecture.
|
||||
* @returns A {@link CameraRuntimeError} or {@link CameraCaptureError}, or the `nativeError` itself if it's not parsable
|
||||
* @returns A {@linkcode CameraRuntimeError} or {@linkcode CameraCaptureError}, or the `nativeError` itself if it's not parsable
|
||||
* @method
|
||||
*/
|
||||
export const tryParseNativeCameraError = <T>(nativeError: T): (CameraRuntimeError | CameraCaptureError) | T => {
|
||||
|
||||
Reference in New Issue
Block a user