/** * Date: 2/8/18 * Time: 9:48 PM * @license MIT (see project's LICENSE file) * */ /** * Custom Error type that has some brains and functionality to: * - figure out where errors happened: context, function, module * - track inner errors so that we can ascend and descend our russian doll errors * - tracking error statuses in the form of HTTP statuses (sort of a common language) */ export declare class PigError extends Error { readonly context?: string; readonly details?: string; readonly error?: Error; readonly metadata?: object; readonly method?: string; readonly module?: string; readonly statusCode?: number; /** * General purpose pig error that hold all of our secrets. He is designed to stash information related to the * error so that we capture and report essential info. You may specify a number of predefined params and include * additional ones. You must supply something that constitutes a "message". Be reasonable and we will find something. * * NOTE: we attempt to find `context`, `method` and `module`. You don't need to include them unless you want to * override the defaults or feel more comfortable doing it. * * @param context - instance of object in which the error occurred. We attempt to automatically find this information. * @param details - details in addition to the principle error or message. * @param error - error that will be promoted to "message" or "details" if they are not specified. * @param message - error text * @param metadata - optional companion data to help define the error. * @param method - calling method. We attempt to automatically find this information. * @param module - the module from which the error was thrown. We will pull it from the stack if not included. * If included then most likely you will want to assign it from `__filename` or `__dirname` * @param statusCode - http code to associate with error. */ constructor({ context, details, error, message, metadata, method, module, statusCode }: { context?: string | object; details?: string; error?: PigError | Error | string; message?: string; metadata?: object; method?: string | Function; module?: string; statusCode?: number; }); /******************** * Private Interface ********************/ /** * Examines the stack and pulls out whatever useful information we can get out of him. */ private stackToDefaults; } //# sourceMappingURL=pig.d.ts.map