Skip to content

Instantly share code, notes, and snippets.

@wightwulf1944
Created July 13, 2018 13:35
Show Gist options
  • Save wightwulf1944/7d11a208dea7f3c35a738db60915f639 to your computer and use it in GitHub Desktop.
Save wightwulf1944/7d11a208dea7f3c35a738db60915f639 to your computer and use it in GitHub Desktop.
Pseudocode recover from exception
doTheThing() {
var result1 = function1Safe()
var result2 = function2Safe()
return result1 + result2
}
function1Safe() {
try {
return function1()
} catch {
return defaultValue
}
}
function2Safe() {
try {
return function2()
} catch {
return defaultValue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment