Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active August 23, 2023 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/f180d0e09abe6dc0f637a142c4a5a58b to your computer and use it in GitHub Desktop.
Save mcsee/f180d0e09abe6dc0f637a142c4a5a58b to your computer and use it in GitHub Desktop.
try {
transaction.commit();
} catch (e) {
logerror(e);
if (e instanceOf DBError) {
try {
transaction.rollback();
} catch (e) {
doMoreLoggingRollbackFailed(e);
}
}
}
// Nested Try catches
// Exception cases are more important than the happy path
// You use exceptions as control flow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment