mirror of https://gitee.com/bigwinds/arangodb
Add SyntheticResponse#throw
This commit is contained in:
parent
106f14cffb
commit
aaaa3ca8f8
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue