Skip to content

Instantly share code, notes, and snippets.

@pjazdzewski1990
Created May 28, 2015 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjazdzewski1990/6841eb1e912b19c87fcb to your computer and use it in GitHub Desktop.
Save pjazdzewski1990/6841eb1e912b19c87fcb to your computer and use it in GitHub Desktop.
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