mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-12 15:22:54 +01:00
Fix: Javascript node error logs (#14)
In some cases the error is a string, and when logging it will write "undefined" into the console instead of providing a useful error message.
This commit is contained in:
@@ -12,6 +12,24 @@ function getAbsoluteUrl(_url) {
|
||||
return (Noodl.baseUrl || '/') + url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an error thrown by the JavaScript nodes.
|
||||
*
|
||||
* @param {any} error
|
||||
*/
|
||||
function logJavaScriptNodeError(error) {
|
||||
if (typeof error === 'string') {
|
||||
console.log('Error in JS node run code.', error);
|
||||
} else {
|
||||
console.log(
|
||||
'Error in JS node run code.',
|
||||
Object.getPrototypeOf(error).constructor.name + ': ' + error.message,
|
||||
error.stack
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAbsoluteUrl
|
||||
getAbsoluteUrl,
|
||||
logJavaScriptNodeError
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user