r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
9 stars 2 forks source link

Make express not quit on error #278

Closed jeroen closed 11 months ago

jeroen commented 1 year ago

See if there is a way to make express not exit node for uncaught errors.

jeroen commented 11 months ago

This works on the node level.

process.on('uncaughtException', (err) => {
  console.log(err);
});

Some of the async IO uncaught exceptions are fixed in express 5, but that seems forever in beta. But you can test it:

npm install "express@>=5.0.0-beta.1" --save

Maybe a restart is actually the safest option in case of OOM errors.

jeroen commented 11 months ago

Decided to not change behavior for now, because restarting on fatal errors may just seem like the safest approach, in case the server is in a bad state.