UNPKG

objection-paginator

Version:
32 lines (31 loc) 1.18 kB
import { ObjectionPaginatorError } from "./objection-paginator-error.js"; /** * An internal enum, used to indicate what kind of validation error to throw * when an invalid cursor value is encountered. */ export declare enum ValidationCase { /** * Indicates that any encountered problems are with the sort configuration, * and should thus cause a ConfigurationError. */ Configuration = 0, /** * Indicates that any encountered problems are with a cursor sent by the * client, and should this cause an InvalidCursorError. */ Cursor = 1 } /** * An internal function for switching error classes based on different cursor * value validation use cases. * * @remarks * This function is necessary because, when we encounter an invalid cursor * value, we need to know whether we're validating during cursor creation or * cursor consumption. This will help users identify where the problem actually * lies. * * @param validationCase - Used to indicate when validation is occurring. * @returns The error class to throw. */ export declare function getErrorClass(validationCase: ValidationCase): typeof ObjectionPaginatorError;