@cto.ai/ops
Version:
💻 CTO.ai Ops - The CLI built for Teams 🚀
48 lines (47 loc) • 1.6 kB
TypeScript
/**
* @author: Prachi Singh (prachi@hackcapital.com)
* @date: Monday, 6th May 2019 11:11:49 am
* @lastModifiedBy: Prachi Singh (prachi@hackcapital.com)
* @lastModifiedTime: Thursday, 3rd October 2019 4:46:05 pm
*
* DESCRIPTION: Base class that the custom errors should be extending from
* Error template that provides a modular, extensible and customizable errors.
* Sourced from https://git.cto.ai/hackcapital/tools/errors
* Modified slightly to fit the application's need
*
* @copyright (c) 2019 Hack Capital
*/
import { IExtra } from '../types';
/**
* ErrorTemplate class provide a base class for customized errors
*
* @extends Error
*/
export declare class ErrorTemplate extends Error {
message: string;
original?: Error | ErrorResponse | undefined;
statusCode?: number | undefined;
errorCode?: string | undefined;
extra: IExtra;
/**
* @constructor
*
* @param {String} [message] Error Message
* @param {Object} [extra] Append any extra information to the error message
* @param {Number} [statusCode] Specific for HTTP request, e.g.: 404
* @param {String} [errorCode] Error codes, e.g.: U0010
* @param {Error} [original] Original error object
*/
constructor(message: string, original?: Error | ErrorResponse | undefined, extra?: IExtra, statusCode?: number | undefined, errorCode?: string | undefined);
}
export interface ErrorResponse {
data: null;
error: GoError[];
message: string;
stack: string;
}
export interface GoError {
requestID: string;
code: number;
message: string;
}