export class RestError extends Error { constructor ( public message , public httpStatusCode , public code ) { super ( message ) ; this . name = 'RestError' ; this . stack = ( < any > new Error ( ) ) . stack ; } toJSON ( ) { return { code : this . code , message : this . message } ; } }