aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/annotations/JsonProtocol.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/firrtl/annotations/JsonProtocol.scala')
-rw-r--r--src/main/scala/firrtl/annotations/JsonProtocol.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/scala/firrtl/annotations/JsonProtocol.scala b/src/main/scala/firrtl/annotations/JsonProtocol.scala
index 5270c26f..b09155d8 100644
--- a/src/main/scala/firrtl/annotations/JsonProtocol.scala
+++ b/src/main/scala/firrtl/annotations/JsonProtocol.scala
@@ -37,7 +37,7 @@ object JsonProtocol {
try {
Class.forName(s).asInstanceOf[Class[_ <: Transform]].newInstance()
} catch {
- case e: java.lang.InstantiationException => throw new FIRRTLException(
+ case e: java.lang.InstantiationException => throw new FirrtlInternalException(
"NoSuchMethodException during construction of serialized Transform. Is your Transform an inner class?", e)
case t: Throwable => throw t
}},
@@ -113,10 +113,11 @@ object JsonProtocol {
// Translate some generic errors to specific ones
case e: java.lang.ClassNotFoundException =>
Failure(new AnnotationClassNotFoundException(e.getMessage))
- case e: org.json4s.ParserUtil.ParseException =>
+ // Eat the stack traces of json4s exceptions
+ case e @ (_: org.json4s.ParserUtil.ParseException | _: org.json4s.MappingException) =>
Failure(new InvalidAnnotationJSONException(e.getMessage))
}.recoverWith { // If the input is a file, wrap in InvalidAnnotationFileException
- case e => in match {
+ case e: FirrtlUserException => in match {
case FileInput(file) =>
Failure(new InvalidAnnotationFileException(file, e))
case _ => Failure(e)