Skip to content

Commit 88f6ac7

Browse files
committed
Revert "Add try/catch w/ error message to plugin calls"
This reverts commit 631e924.
1 parent 2912854 commit 88f6ac7

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

src/core/init/lifecycle.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,14 @@ export function Lifecycle(Base) {
3636
if (index >= queue.length) {
3737
next(data);
3838
} else if (typeof hookFn === 'function') {
39-
const errTitle = `Docsify plugin ${
40-
hookFn.name ? '"' + hookFn.name + '"' : ''
41-
} error (${hookName})`;
42-
4339
if (hookFn.length === 2) {
44-
try {
45-
hookFn(data, result => {
46-
data = result;
47-
});
48-
} catch (err) {
49-
console.error(errTitle, err);
50-
}
51-
step(index + 1);
40+
hookFn(data, result => {
41+
data = result;
42+
step(index + 1);
43+
});
5244
} else {
53-
let result;
54-
55-
try {
56-
result = hookFn(data);
57-
} catch (err) {
58-
console.error(errTitle, err);
59-
}
60-
61-
data = result || data;
45+
const result = hookFn(data);
46+
data = result === undefined ? data : result;
6247
step(index + 1);
6348
}
6449
} else {

0 commit comments

Comments
 (0)