Created
July 8, 2017 08:20
-
-
Save AlecTaylor/0f3f360ec4e90927d003a5f4f53d7306 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// verror is what the restify errors inherit from | |
// see: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/verror/index.d.ts#L20 | |
// see: https://github.com/restify/errors | |
import { RestError } from 'restify'; | |
import { inherits } from 'util'; | |
import { GenericErrorArgs, ICustomError } from 'restify-errors'; | |
import * as verror from 'verror'; | |
import VError = require('verror'); | |
class RestErrorBase extends Error implements VError { | |
public cause = verror.cause as any; | |
public info = verror.info; | |
public fullStack = verror.fullStack; | |
public findCauseByName = verror.findCauseByName; | |
public hasCauseWithName = verror.hasCauseWithName; | |
public errorFromList = verror.errorFromList; | |
public errorForEach = verror.errorForEach; | |
public name: string; | |
public message: string; | |
public restCode: string; | |
public statusCode: string; | |
public body: {error: string, error_message: string}; | |
} | |
export class RestErrorC extends RestErrorBase { | |
constructor(message: string, ...params: any[]) { | |
super(message); | |
// Set the prototype explicitly. | |
Object.setPrototypeOf(this, RestErrorBase.prototype); | |
} | |
// constructor(options: VError.Options | Error, message: string, ...params: any[]); | |
// constructor(message: string, ...params: any[]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment