From edcb81a34dbf8a04d0b011aa1ca07c6e19598f23 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 16 Feb 2018 17:10:30 -0800 Subject: Replacematcherror - catch exceptions and convert to internal error. (#424) * Catch exceptions and convert to internal error. We need to update the displayed message to incorporate a line number and text to be used for the issue. * Cleanup exception handling/throwing. Re-throw expected (or uncorrectable exceptions). Provide Utils.getThrowable() to get the first (eldest) or last throwable in the chain. Update tests to conform to FreeSpec protocol. * Minor cleanup Admit we've updated some deprecated ScalaTest methods. --- src/main/scala/firrtl/annotations/AnnotationUtils.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/scala/firrtl/annotations') diff --git a/src/main/scala/firrtl/annotations/AnnotationUtils.scala b/src/main/scala/firrtl/annotations/AnnotationUtils.scala index ab580e88..240c46d6 100644 --- a/src/main/scala/firrtl/annotations/AnnotationUtils.scala +++ b/src/main/scala/firrtl/annotations/AnnotationUtils.scala @@ -56,7 +56,7 @@ object AnnotationUtils { val DecPattern = """([1-9]\d*)""".r def findClose(tokens: Seq[String], index: Int, nOpen: Int): Seq[String] = { if(index >= tokens.size) { - error("Cannot find closing bracket ]") + Utils.error("Cannot find closing bracket ]") } else tokens(index) match { case "[" => findClose(tokens, index + 1, nOpen + 1) case "]" if nOpen == 1 => tokens.slice(1, index) @@ -81,6 +81,8 @@ object AnnotationUtils { } if(validComponentName(s)) { parse(tokenize(s)) - } else error(s"Cannot convert $s into an expression.") + } else { + Utils.error(s"Cannot convert $s into an expression.") + } } } -- cgit v1.2.3