mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
bug fix
This commit is contained in:
1 parent
560e920624
commit
d59710ddf1
13 files changed
+181
-49
No files matched your search
+11
-1
@@ -5,7 +5,17 @@ function warp(func, type) {
|
||||
const time = new Date();
|
||||
func(...args);
|
||||
if (global.Hydro.model.message) {
|
||||
global.Hydro.model.message.send(1, 1, yaml.safeDump({ time, type, args }));
|
||||
try {
|
||||
for (let i = 0; i <= args.length; i++) {
|
||||
if (args[i] instanceof Error) {
|
||||
// js-yaml cannot dump [object Error]
|
||||
args[i] = `${args[i].message}\n${args[i].stack}`;
|
||||
}
|
||||
}
|
||||
global.Hydro.model.message.send(1, 1, yaml.dump({ time, type, args }, {}));
|
||||
} catch (e) {
|
||||
func(e.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user