@egjs/flicking
Version:
Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
80 lines (79 loc) • 2.45 kB
TypeScript
/**
* Error codes of {@link FlickingError}.
* @remarks
* Each error code represents a specific error condition that can occur during Flicking's lifecycle.
* Use these codes to identify and handle errors programmatically.
*
* For detailed documentation of each error code, see {@link FlickingErrors}.
* @example
* ```typescript
* import {FlickingError, ERROR_CODE} from "@egjs/flicking";
*
* try {
* flicking.moveTo(999);
* } catch (err) {
* if (err instancof FlickingError && err.code === ERROR_CODE.INDEX_OUT_OF_RANGE) {
* console.log(err.message);
* }
* }
* ```
* @public
* @see {@link FlickingErrors} for detailed documentation of each error code
*/
export declare const CODE: {
WRONG_TYPE: 0;
ELEMENT_NOT_FOUND: 1;
VAL_MUST_NOT_NULL: 2;
NOT_ATTACHED_TO_FLICKING: 3;
WRONG_OPTION: 4;
INDEX_OUT_OF_RANGE: 5;
POSITION_NOT_REACHABLE: 6;
TRANSFORM_NOT_SUPPORTED: 7;
STOP_CALLED_BY_USER: 8;
ANIMATION_INTERRUPTED: 9;
ANIMATION_ALREADY_PLAYING: 10;
NOT_ALLOWED_IN_FRAMEWORK: 11;
NOT_INITIALIZED: 12;
NO_ACTIVE: 13;
NOT_ALLOWED_IN_VIRTUAL: 14;
};
/**
* Error message generators for {@link FlickingError}.
* @remarks
* These functions generate human-readable error messages for each error code.
* Used internally by Flicking to create {@link FlickingError} instances with
* contextual information.
* @internal
*/
export declare const MESSAGE: {
WRONG_TYPE: (wrongVal: any, correctTypes: string[]) => string;
ELEMENT_NOT_FOUND: (selector: string) => string;
VAL_MUST_NOT_NULL: (val: any, name: string) => string;
NOT_ATTACHED_TO_FLICKING: string;
WRONG_OPTION: (optionName: string, val: any) => string;
INDEX_OUT_OF_RANGE: (val: number, min: number, max: number) => string;
POSITION_NOT_REACHABLE: (position: number) => string;
TRANSFORM_NOT_SUPPORTED: string;
STOP_CALLED_BY_USER: string;
ANIMATION_INTERRUPTED: string;
ANIMATION_ALREADY_PLAYING: string;
NOT_ALLOWED_IN_FRAMEWORK: string;
NOT_INITIALIZED: string;
NO_ACTIVE: string;
NOT_ALLOWED_IN_VIRTUAL: string;
};
/**
* Alias for {@link CODE}.
* @remarks
* Exported as `ERROR_CODE` for semantic clarity when importing.
* @example
* ```typescript
* import { ERROR_CODE } from "@egjs/flicking";
*
* if (err.code === ERROR_CODE.INDEX_OUT_OF_RANGE) {
* // Handle index error
* }
* ```
* @public
*/
export { CODE as ERROR_CODE };