twilio
Version:
A Twilio helper library
18 lines (13 loc) • 451 B
JavaScript
;
var util = require('util');
function RestException(response) {
Error.call('[HTTP ' + response.statusCode + '] Failed to execute request');
var body = JSON.parse(response.body);
this.status = response.statusCode;
this.message = body.message;
this.code = body.code;
this.moreInfo = body.more_info; /* jshint ignore:line */
this.detail = body.detail;
}
util.inherits(RestException, Error);
module.exports = RestException;