summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/internal
diff options
context:
space:
mode:
authorJim Lawson2016-11-10 10:05:15 -0800
committerJim Lawson2016-11-10 10:05:15 -0800
commit2e62da09ed1ed0725a14185ae76a683da73b32f4 (patch)
tree29cc5966074ba9eb71c4a8bced5d8ff1f2601cae /chiselFrontend/src/main/scala/chisel3/internal
parentb2b80ce24881782b82b545e0e3cb2a0e4ef83557 (diff)
Throw exceptions for cloneType failures - fix #358
Add a Builder.exception() method for those cases where continuing is likely to mask the initial error.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/internal')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/internal/Builder.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala
index b4b0e028..32ba248c 100644
--- a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala
+++ b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala
@@ -188,6 +188,16 @@ private[chisel3] object Builder {
def warning(m: => String): Unit = errors.warning(m)
def deprecated(m: => String): Unit = errors.deprecated(m)
+ /** Record an exception as an error, and throw it.
+ *
+ * @param m exception message
+ */
+ @throws(classOf[ChiselException])
+ def exception(m: => String): Unit = {
+ error(m)
+ throwException(m)
+ }
+
def build[T <: Module](f: => T): Circuit = {
dynamicContextVar.withValue(Some(new DynamicContext())) {
errors.info("Elaborating design...")