Skip to content

Instantly share code, notes, and snippets.

@Azdaroth
Created December 22, 2015 07:28
Show Gist options
  • Save Azdaroth/9aeca9b071b8308c7907 to your computer and use it in GitHub Desktop.
Save Azdaroth/9aeca9b071b8308c7907 to your computer and use it in GitHub Desktop.
let errorHandlers = {
isAuthenticationError: transitionAway,
IsImportantDataError: showError,
isUnimportantDataError: keepTrying
};
let errorHandler = Object.keys(errorHandlers).find(function(isCurrentError) { isCurrentError(errorFromTryCatch) });
errorHandler(errorFromTryCatch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment