Skip to content

Server crashed if asynchronous function get error. (uncaughtException) #8193

Closed
@JeffGuKang

Description

@JeffGuKang

Parse Server crashed when I call some asynchronous function that throws error.
I resolved issue patch the code as below.

uncaughtException

I think process.on('uncaughtException', ...) throw error should be treat in client instead of parse.

How about changing code as below?

if (!process.env.TESTING) {
//This causes tests to spew some useless warnings, so disable in test
/* istanbul ignore next */
process.on('uncaughtException', err => {
if (err.code === 'EADDRINUSE') {
// user-friendly message for this common error
process.stderr.write(`Unable to listen on port ${err.port}. The port is already in use.`);
process.exit(0);
} else {
throw err;
}
});

process.on('uncaughtException', err => {
  if (err.code === 'EADDRINUSE') {
    // user-friendly message for this common error
    process.stderr.write(`Unable to listen on port ${err.port}. The port is already in use.`);
    process.exit(0);
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions