mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
[jsscripting] Fix the console.trace
polyfill to log a stack trace & Stringify JS Error
(#13749)
* [jsscripting] Fix the `console.trace` polyfill to log a stack trace & Stringify JS `Error` * [jsscripting] Add myself to the codeowners Fixes #12646 Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
parent
54e934be3d
commit
103619741d
@ -7,7 +7,7 @@
|
||||
# Add-on maintainers:
|
||||
/bundles/org.openhab.automation.groovyscripting/ @wborn
|
||||
/bundles/org.openhab.automation.jrubyscripting/ @boc-tothefuture
|
||||
/bundles/org.openhab.automation.jsscripting/ @jpg0
|
||||
/bundles/org.openhab.automation.jsscripting/ @jpg0 @florian-h05
|
||||
/bundles/org.openhab.automation.jythonscripting/ @openhab/add-ons-maintainers
|
||||
/bundles/org.openhab.automation.pidcontroller/ @fwolter
|
||||
/bundles/org.openhab.automation.pwm/ @fwolter
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
function stringify (value) {
|
||||
try {
|
||||
if (Java.isJavaObject(value)) {
|
||||
if (Java.isJavaObject(value) || value instanceof Error) {
|
||||
return value.toString();
|
||||
} else {
|
||||
// special cases
|
||||
@ -129,20 +129,8 @@
|
||||
log.error(format.apply(null, arguments));
|
||||
},
|
||||
|
||||
trace: function (e) {
|
||||
if (Java.isJavaObject(e)) {
|
||||
log.trace(e.getLocalizedMessage(), e);
|
||||
} else {
|
||||
if (e.stack) {
|
||||
log.trace(e.stack);
|
||||
} else {
|
||||
if (e.message) {
|
||||
log.trace(format.apply(null, [(e.name || 'Error') + ':', e.message]));
|
||||
} else {
|
||||
log.trace((e.name || 'Error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
trace: function () {
|
||||
log.trace(new Error(format.apply(null, arguments)).stack.replace(/^Error: /, ''));
|
||||
},
|
||||
|
||||
time: function (label) {
|
||||
|
Loading…
Reference in New Issue
Block a user