Last active
August 23, 2023 01:15
-
-
Save mcsee/f180d0e09abe6dc0f637a142c4a5a58b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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