UNPKG

kuzzle-sdk

Version:
102 lines (101 loc) 2.7 kB
import { RequestPayload } from "./types/RequestPayload"; import { JSONObject } from "./types"; /** * Standard Kuzzle error. * * @see https://docs.kuzzle.io/core/2/api/errors/types/ */ export declare class KuzzleError extends Error { /** * Http status code */ status: number; /** * Stacktrace */ stack: string; /** * Kuzzle stacktrace (development mode only) */ kuzzleStack?: string; /** * Unique ID */ id: string; /** * Code */ code: number; /** * API controller name */ controller?: string; /** * API action name */ action?: string; /** * KuzzleRequest volatile data */ volatile?: Record<string, unknown>; /** * Index name */ index?: string; /** * Collection name */ collection?: string; /** * request id */ requestId?: string; /** * Document unique identifier */ _id?: string; /** * Associated errors * (PartialError only) */ errors?: Array<any>; /** * Number of associated errors * (PartialError only) */ count?: number; /** * Placeholders used to construct the error message */ props?: string[]; /** * This class represents a Kuzzle API error. * The SDK stack is needed alongside the protocol used. * Those information will allow to construct a enhanced stacktrace: * * BadRequestError: Trololol at new BadRequestError (/home/aschen/projets/kuzzleio/kuzzle/lib/kerror/errors/badRequestError.ts:26:5) > at BaseController.handler [as sayHello] (/home/aschen/projets/kuzzleio/kuzzle/test.js:9:15) at doAction (/home/aschen/projets/kuzzleio/kuzzle/lib/api/funnel.js:759:47) at Funnel.processRequest (/home/aschen/projets/kuzzleio/kuzzle/lib/api/funnel.js:423:34) | | HttpProtocol | | at HttpProtocol.query (/home/aschen/projets/kuzzleio/sdk-javascript/src/protocols/abstract/Base.ts:127:19) at Proxy.query (/home/aschen/projets/kuzzleio/sdk-javascript/src/Kuzzle.ts:598:26) > at /home/aschen/projets/kuzzleio/sdk-javascript/test.js:8:18 at processTicksAndRejections (internal/process/task_queues.js:97:5) */ constructor(apiError: { message: string; status?: number; id?: string; code?: number; errors?: JSONObject[]; count?: number; stack?: string; props?: string[]; }, sdkStack?: string, protocol?: string, request?: RequestPayload); }