Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Only catch Exception #1322

Closed
wants to merge 1 commit into from

2 participants

@nafg

Scala 2.10 warns on catch { case x => ... }, since it will catch all Throwables, including OutOfMemory, etc. Usually you want case x: Exception. This adds it, in only a few places.

@fmpwizard
Owner

+1

@fmpwizard
Owner

if this compiles in 2.9.1, could you rebase it onto master?

@nafg nafg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2012
  1. @nafg

    Only catch Exception

    nafg authored
This page is out of date. Refresh to see the latest.
View
2  core/json/src/main/scala/net/liftweb/json/JsonParser.scala
@@ -237,7 +237,7 @@ object JsonParser {
unquote(buf)
} catch {
case p: ParseException => throw p
- case _ => fail("unexpected string end")
+ case _: Exception => fail("unexpected string end")
}
def parseValue(first: Char) = {
View
2  core/util/src/main/scala/net/liftweb/util/CssSel.scala
@@ -908,4 +908,4 @@ final case class ToCssBindPromoter(stringSelector: Box[String], css: Box[CssSele
* @return the function that will transform an incoming DOM based on the transform rules
*/
def replaceWith[T](it: => T)(implicit computer: ComputeTransformRules[T]): CssSel = this.#>(it)(computer)
-}
+}
View
2  core/util/src/main/scala/net/liftweb/util/TimeHelpers.scala
@@ -432,7 +432,7 @@ trait TimeHelpers { self: ControlHelpers =>
case o => toDate(o.toString)
}
} catch {
- case e => logger.debug("Error parsing date "+in, e); Failure("Bad date: "+in, Full(e), Empty)
+ case e: Exception => logger.debug("Error parsing date "+in, e); Failure("Bad date: "+in, Full(e), Empty)
}
}
}
View
2  persistence/mapper/src/main/scala/net/liftweb/mapper/FieldFinder.scala
@@ -83,7 +83,7 @@ class FieldFinder[T: ClassManifest](metaMapper: AnyRef, logger: net.liftweb.comm
}
} catch {
- case e =>
+ case e: Exception =>
logger.debug("Not a valid mapped field: %s, got exception: %s".format(meth.getName, e))
false
}
Something went wrong with that request. Please try again.