Created
May 28, 2015 06:09
-
-
Save pjazdzewski1990/6841eb1e912b19c87fcb to your computer and use it in GitHub Desktop.
This file contains 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
object CustomMode { | |
implicit val seqMode = new Mode[ParseMethods] { | |
type Wrap[+T, E <: Exception] = Seq[T] | |
override def wrap[T, E <: Exception: ClassTag](t: => T): Seq[T] = | |
try Seq(t) catch { | |
case e: Exception => Seq.empty[T] | |
} | |
protected def unwrap[Return](value: Wrap[Return, _ <: Exception]): Return = value.head | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment