aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/annotations/AnnotationUtils.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/firrtl/annotations/AnnotationUtils.scala')
-rw-r--r--src/main/scala/firrtl/annotations/AnnotationUtils.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/annotations/AnnotationUtils.scala b/src/main/scala/firrtl/annotations/AnnotationUtils.scala
index 6b7f9a60..517cea26 100644
--- a/src/main/scala/firrtl/annotations/AnnotationUtils.scala
+++ b/src/main/scala/firrtl/annotations/AnnotationUtils.scala
@@ -3,6 +3,8 @@
package firrtl
package annotations
+import java.io.File
+
import org.json4s._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization
@@ -14,7 +16,15 @@ import firrtl.annotations.AnnotationYamlProtocol._
import firrtl.ir._
import firrtl.Utils.error
-class InvalidAnnotationFileException(msg: String) extends FIRRTLException(msg)
+case class InvalidAnnotationFileException(file: File, cause: Throwable = null)
+ extends FIRRTLException(s"$file, see cause below", cause)
+case class InvalidAnnotationJSONException(msg: String) extends FIRRTLException(msg)
+case class AnnotationFileNotFoundException(file: File) extends FIRRTLException(
+ s"Annotation file $file not found!"
+)
+case class AnnotationClassNotFoundException(className: String) extends FIRRTLException(
+ s"Annotation class $className not found! Please check spelling and classpath"
+)
object AnnotationUtils {
def toYaml(a: LegacyAnnotation): String = a.toYaml.prettyPrint