Change close/flushes to return false on failure#3823
Change close/flushes to return false on failure#3823cnorthwood wants to merge 1 commit intogetsentry:masterfrom cnorthwood:patch-1
Conversation
This matches the comment, and currently rejecting a promise will cause an uncaught promise exception which doesn't get caught and the causes the application to crash. Additionally, rejecting a promise with a boolean doesn't cause a stack trace which made this hard to diagnose. If keeping the rejection is preferred, then it should instead reject with an error object, not just a boolean.
|
Personally agree that it should be logger.error(`Error while flushing events: no client available`);just before the This change should be backwards compatible, as attached rejection handlers will still convert inside Sentry.flush(2000).catch(e => {
console.error('Unable to flush')
})however, in this case as you mentioned This should also be changed in ref: #3031 |
|
@cnorthwood - Would you like to make Kamil's suggested changes here, or shall I open a separate PR? |
|
@lobsterkatie if you want to have a look that'd be great! It's still on my to-do list to have a look at this but don't let me block it |
|
Okay - I've replicated your work (and Kamil's suggestions) in #3846, so I'm going to close this. Thanks for the contribution, though! |
|
Thank you for picking this up @lobsterkatie :) |
This matches the comment, and currently rejecting a promise will cause an uncaught promise exception which doesn't get caught and the causes the application to crash. Additionally, rejecting a promise with a boolean doesn't cause a stack trace which made this hard to diagnose. If keeping the rejection is preferred, then it should instead reject with an error object, not just a boolean.
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).