Created
July 13, 2018 13:35
-
-
Save wightwulf1944/7d11a208dea7f3c35a738db60915f639 to your computer and use it in GitHub Desktop.
Pseudocode recover from exception
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
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