diff options
author | Paul Phillips <paulp@improving.org> | 2009-06-24 15:19:09 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-06-24 15:19:09 +0000 |
commit | 1c9870541fb22ac032edaa0be0103cc1aa2c99b4 (patch) | |
tree | 881d38aa5dfba0542295e7e56e642a77cd3852b6 /src/library/scala/util/control/Exception.scala | |
parent | 6ab1f0b7710af132401848bc25da9101a364093b (diff) | |
download | scala-1c9870541fb22ac032edaa0be0103cc1aa2c99b4.tar.gz scala-1c9870541fb22ac032edaa0be0103cc1aa2c99b4.tar.bz2 scala-1c9870541fb22ac032edaa0be0103cc1aa2c99b4.zip |
More work and documentation for GenericRanges, ...
More work and documentation for GenericRanges, plus minor findbugs
noticed issues.
Diffstat (limited to 'src/library/scala/util/control/Exception.scala')
-rw-r--r-- | src/library/scala/util/control/Exception.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala index 769be2fef8..3b0590ca37 100644 --- a/src/library/scala/util/control/Exception.scala +++ b/src/library/scala/util/control/Exception.scala @@ -167,8 +167,12 @@ object Exception * an exception handler function as an argument to "by". Example: * handling(ex1, ex2) by (_.printStackTrace) */ - def handling[T](exceptions: Class[_]*) = new { - def by(f: (Throwable) => T): Catch[T] = catching(exceptions: _*) withApply f + class By[T,R](f: T => R) { + def by(x: T): R = f(x) + } + def handling[T](exceptions: Class[_]*) = { + def fun(f: Throwable => T) = catching(exceptions: _*) withApply f + new By[Throwable => T, Catch[T]](fun _) } /** Returns a Catch object with no catch logic and the argument as Finally. */ |