Created
August 23, 2019 17:07
-
-
Save varmas/ed74a50a45df484acf2febe29551a81c to your computer and use it in GitHub Desktop.
exception wrapper 2
This file contains hidden or 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
def errorWrapper[T](message: String, fn: => T): T = { | |
try { | |
logger.warn(s"Attempting [$message]") | |
fn | |
} catch { | |
case ex: Throwable => logger.error(s"[$message] error", ex) | |
throw ex | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment