agracio / electron-edge-js

Run .NET and Node.js code in-process on Windows, MacOS, and Linux
MIT License
354 stars 92 forks source link

Silent Failure when .NET 4.5 isn't installed #129

Closed Craigzyc closed 7 months ago

Craigzyc commented 2 years ago

Hi,

I have an issue where if I don't put a process.on('uncaughtException" handler it throws a generic program failure which displays a useless error to the end user if .NET 4.5 is not installed. I want to catch that error, and handle my own error dialog to give the end user guidance to fix it.

However, If I do something like this

process
  .on('unhandledRejection', (reason, p) => {
    console.error(reason, 'Unhandled Rejection at Promise', p);
  })
  .on('uncaughtException', err => {

    new Notification({ title: origin, body: err }).show()
    console.error(err, 'Uncaught Exception thrown');
    setTimeout(()=>{
        process.exit(1);
    },5000)
  });

Where I would put some if logic to check if the errors due to the .Net issue then display the appropriate error, it never fires. This does not catch the error, instead, in this situation, it just quietly hangs, then exits. Launching the program from command line shows it hangs right before the require, then does nothing. A few seconds later my task bar icon disappears signaling the program has exited.(but not from the process.exit(1) from above as the console doesnt log, nor does the Notification fire.)

Is there a way to get better error handling in this situation?

image This shows up in the console, after the message to close the program, but it doesn't seem catchable inside node itself