aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/Utils.scala
diff options
context:
space:
mode:
authorJack Koenig2019-08-19 23:45:07 -0700
committerGitHub2019-08-19 23:45:07 -0700
commitd1a682f47935009215f56664cefae0de26e2eabf (patch)
tree2dac347abf87dcfd0018cb4e42d563c2bd78050d /src/main/scala/firrtl/Utils.scala
parent0f6b9615213a2a9770974ff71b3da3f6b770a772 (diff)
Refactor exceptions to remove stack trace from user errors (#1157)
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
-rw-r--r--src/main/scala/firrtl/Utils.scala18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala
index 206afc09..91da600a 100644
--- a/src/main/scala/firrtl/Utils.scala
+++ b/src/main/scala/firrtl/Utils.scala
@@ -13,20 +13,6 @@ import scala.util.matching.Regex
import firrtl.annotations.{ReferenceTarget, TargetToken}
import _root_.logger.LazyLogging
-object FIRRTLException {
- def defaultMessage(message: String, cause: Throwable) = {
- if (message != null) {
- message
- } else if (cause != null) {
- cause.toString
- } else {
- null
- }
- }
-}
-class FIRRTLException(val str: String, cause: Throwable = null)
- extends RuntimeException(FIRRTLException.defaultMessage(str, cause), cause)
-
object seqCat {
def apply(args: Seq[Expression]): Expression = args.length match {
case 0 => Utils.error("Empty Seq passed to seqcat")
@@ -434,7 +420,7 @@ object Utils extends LazyLogging {
}
// =================================
- def error(str: String, cause: Throwable = null) = throw new FIRRTLException(str, cause)
+ def error(str: String, cause: Throwable = null) = throw new FirrtlInternalException(str, cause)
//// =============== EXPANSION FUNCTIONS ================
def get_size(t: Type): Int = t match {
@@ -632,7 +618,7 @@ object Utils extends LazyLogging {
case EmptyExpression => root
}
- case class DeclarationNotFoundException(msg: String) extends FIRRTLException(msg)
+ case class DeclarationNotFoundException(msg: String) extends FirrtlUserException(msg)
/** Gets the root declaration of an expression
*