Skip to content

Instantly share code, notes, and snippets.

@YurkaninRyan
Created March 18, 2019 12:08
Show Gist options
  • Save YurkaninRyan/fc66510d3548e597084c05db9fb464a5 to your computer and use it in GitHub Desktop.
Save YurkaninRyan/fc66510d3548e597084c05db9fb464a5 to your computer and use it in GitHub Desktop.
function double(x) {
if (!Number.isFinite(x)) {
throw `double(x): ${x} is not a number`;
}
return x * 2
}
// We don't have to be aware anymore!
function doublePlusOne(x) {
return double(x) + 1;
}
// anyone consuming our code can wrap at the top level!
try {
doublePlusOne("😵")
} catch (error) {
ErrorService.log(error);
if (!env.PROD) {
console.error(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment