Scala - Try with exception logging -
scala's try useful. i'd utilize pattern, log exceptions. how can this?
define next helper:
import scala.util.{try, failure} def logtry[a](computation: => a): try[a] = { try(computation) recoverwith { case e: throwable => log(e) new failure(e) } } then can utilize use try, exception logged through log(e).
scala exception logging
No comments:
Post a Comment