http: catch rpc errors.
This commit is contained in:
parent
197e9f7aa9
commit
d0c4ea008b
@ -391,7 +391,7 @@ HTTPServer.prototype._init = function _init() {
|
||||
self.rpc = new RPC(self.node);
|
||||
}
|
||||
|
||||
self.rpc.execute(req.body, function(err, json) {
|
||||
function handle(err, json) {
|
||||
if (err) {
|
||||
self.logger.error(err);
|
||||
|
||||
@ -418,7 +418,13 @@ HTTPServer.prototype._init = function _init() {
|
||||
error: null,
|
||||
id: req.body.id
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
self.rpc.execute(req.body, handle);
|
||||
} catch (e) {
|
||||
handle(e);
|
||||
}
|
||||
});
|
||||
|
||||
this.get('/', function(req, res, next, send) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user