mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
refactor(dom) RESTful: add tryToCatch wrapper
This commit is contained in:
parent
8ac3211a86
commit
7b6e767ccb
10 changed files with 40 additions and 51 deletions
|
|
@ -1,11 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
const {promisify} = require('es6-promisify');
|
||||
const wraptile = require('wraptile/legacy');
|
||||
const tryToCatch = require('try-to-catch/legacy');
|
||||
|
||||
module.exports = (fn, ...args) => {
|
||||
module.exports = wraptile((fn, ...args) => {
|
||||
const promise = promisify(fn);
|
||||
|
||||
return tryToCatch(promise, ...args);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue