rpc: add RPCError.
This commit is contained in:
parent
3406a09cd5
commit
4a398517d9
File diff suppressed because it is too large
Load Diff
@ -333,7 +333,16 @@ HTTPServer.prototype._init = function _init() {
|
||||
self.rpc.execute(req.body, function(err, json) {
|
||||
if (err) {
|
||||
self.logger.error(err);
|
||||
return send(400, {
|
||||
|
||||
if (err.type === 'RPCError') {
|
||||
return send(400, {
|
||||
result: err.message,
|
||||
error: null,
|
||||
id: req.body.id
|
||||
});
|
||||
}
|
||||
|
||||
return send(500, {
|
||||
result: null,
|
||||
error: {
|
||||
message: err.message,
|
||||
@ -342,6 +351,7 @@ HTTPServer.prototype._init = function _init() {
|
||||
id: req.body.id
|
||||
});
|
||||
}
|
||||
|
||||
send(200, {
|
||||
result: json,
|
||||
error: null,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user