1
0
Fork 0

Add SyntheticResponse#throw

This commit is contained in:
Alan Plum 2016-04-14 13:52:40 +02:00
parent 106f14cffb
commit aaaa3ca8f8
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
1 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,7 @@
const _ = require('lodash');
const fs = require('fs');
const vary = require('vary');
const httperr = require('http-errors');
const statuses = require('statuses');
const mediaTyper = require('media-typer');
const mimeTypes = require('mime-types');
@ -272,6 +273,13 @@ module.exports = class SyntheticResponse {
return this;
}
throw(status, reason, args) {
if (typeof status === 'string') {
status = statuses(status);
}
throw Object.assign(httperr(status, reason), args);
}
send(body, type) {
if (body && body.isArangoResultSet) {
body = body.toArray();