capturing node errors with line numbers etc

23 views
Skip to first unread message

Tim willhack

unread,
Mar 25, 2023, 4:24:56 PM3/25/23
to nw.js
Hello, I'm basically using nwjs as a basic interface for my node scripts.  Previously they just ran until the end.  I'd like to be able to capture syntax errors etc as they hit and dump them to an html textbox.  I realize I should refresh the app at that point.  I have a textbox that is my 'log' and I don't want to have to look in dev tools for these errors.  I've read things like "process.on("uncaughtException", function(e) { mylog(e); });" or trying it with window.onerror: "$(window).on('error', mylog('error'));", but for some reason both of these don't seem to do anything.  I put a breakpoint in each function and they never fire when the error happens.  It shows up in dev tools with line numbers etc but I can't seem to capture it in my javascript.  I've even tried overriding console.error like this: console.error = error => { mylog(error) };

Tim willhack

unread,
Mar 25, 2023, 5:07:02 PM3/25/23
to nw.js
My first find is that I believe my problem is the error I started to try to track was in an async function...  I forgot how fun javascript is
Reply all
Reply to author
Forward
0 new messages