mbeckerle commented on a change in pull request #140: TDML Runner and test 
changes for Cross Validation with IBM.
URL: https://github.com/apache/incubator-daffodil/pull/140#discussion_r234390675
 
 

 ##########
 File path: 
daffodil-tdml/src/main/scala/org/apache/daffodil/tdml/TDMLException.scala
 ##########
 @@ -17,16 +17,72 @@
 
 package org.apache.daffodil.tdml
 
-class TDMLException(msg: String, val causes: Seq[Throwable])
-  extends Exception(msg, if (causes.length > 0) causes(0) else null) {
+import org.apache.daffodil.api.Diagnostic
+import org.apache.daffodil.util.Maybe
+import org.junit.AssumptionViolatedException
 
-  def this(msg: String) = this(msg, Nil)
+object TDMLException {
 
-  def this(cause: Throwable) = this(cause.getMessage(), List(cause))
+  def msgWithImpl(msg: String, implementation: String) =
+    if (implementation != "none" &&
+      implementation != "daffodil")
+      "(Implementation: " + implementation + ") " + msg
+    else msg
 
-  def this(causes: Seq[Throwable]) = this(
-    {
-      causes.map { _.getMessage() }.mkString("\n")
-    },
-    causes)
+  def apply(msg: String, implementation: String) = new TDMLExceptionImpl(msg, 
implementation)
+  def apply(cause: Throwable, implementation: String) = new 
TDMLExceptionImpl(cause, implementation)
+  def apply(causes: Seq[Throwable], implementation: String) = new 
TDMLExceptionImpl(causes, implementation)
+}
+
+trait TDMLException { self: Exception =>
 
 Review comment:
   Scaladoc. Why a trait? Ans: because we want TDMLException to be a generic 
type that can catch all TDMLExceptions even though there isn't a common 
inheritance from a single base class. This enables the 
TDMLTestNotCompatibleException.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to