mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
added express-promise-wrap to catch and respond to unhandled exceptions immediately, previously the requests just hanged
This commit is contained in:
@@ -4,8 +4,9 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const auth = require('../../services/auth');
|
||||
const sql = require('../../services/sql');
|
||||
const wrap = require('express-promise-wrap').wrap;
|
||||
|
||||
router.post('/execute', auth.checkApiAuth, async (req, res, next) => {
|
||||
router.post('/execute', auth.checkApiAuth, wrap(async (req, res, next) => {
|
||||
const query = req.body.query;
|
||||
|
||||
try {
|
||||
@@ -20,6 +21,6 @@ router.post('/execute', auth.checkApiAuth, async (req, res, next) => {
|
||||
error: e.message
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user