Skip to content

Instantly share code, notes, and snippets.

@eldorplus
Forked from nadeesha/tryCatch.js
Created June 6, 2019 17:22
Show Gist options
  • Select an option

  • Save eldorplus/04215655c20099308bb70edd1b62786e to your computer and use it in GitHub Desktop.

Select an option

Save eldorplus/04215655c20099308bb70edd1b62786e to your computer and use it in GitHub Desktop.
export function tryCatch({
tryer,
catcher
}) {
return (props) => {
try {
return tryer(props);
} catch (e) {
return catcher(props, e.message);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment