Skip to content

Commit e1f5d83

Browse files
committed
fix: try-catch: ERR_REQUIRE_CYCLE_MODULE
1 parent ca8242f commit e1f5d83

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/try-catch.cjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
'use strict';
22

3-
const {tryCatch} = require('./try-catch.js');
3+
const tryCatch = (fn, ...args) => {
4+
try {
5+
return [null, fn(...args)];
6+
} catch(e) {
7+
return [e];
8+
}
9+
};
410

511
module.exports = tryCatch;
612
module.exports.tryCatch = tryCatch;

0 commit comments

Comments
 (0)