Skip to content

Conversation

@RulaKhaled
Copy link
Member

Problem

withMonitor function was causing unhandled promise rejections when wrapping async callbacks that throw errors. This could crash servers when monitoring async operations.

When a promise returned by the callback rejected, the error was being thrown inside the promise rejection handler:

Promise.resolve(maybePromiseResult).then(
  () => { finishCheckIn('ok'); },
  e => {
    finishCheckIn('error');
    throw e;  // This causes unhandled rejection
  },
);

Solution

Simply remove the throw e; line. The original promise is already returned to the caller, so they can handle the rejection appropriately.

Fixes #JS-620

@RulaKhaled RulaKhaled marked this pull request as draft June 27, 2025 09:16
@codecov
Copy link

codecov bot commented Jun 27, 2025

❌ Unsupported file format

Upload processing failed due to unsupported file format. Please review the parser error message:
Error deserializing json

Caused by:
expected value at line 1 column 1

For more help, visit our troubleshooting guide.

@RulaKhaled RulaKhaled closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant