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_r234390740
##########
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 =>
+ def msg: String
+ def causes: Seq[Throwable]
+ def implementation: String
+
Review comment:
Comment in code here about why these method prototypes are here. It's
because while this has self type of Exception, that doesn't give it an
implementation of all methods of Exception. The methods we use and want exposed
from Exception have to be mentioned here. They're implemented when this is
mixed in to an Exception class.
----------------------------------------------------------------
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