olabusayoT commented on code in PR #1196:
URL: https://github.com/apache/daffodil/pull/1196#discussion_r1543412959
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/api/DFDLParserUnparser.scala:
##########
@@ -236,8 +236,12 @@ object DFDL {
* Thrown by the DaffodilUnparseConentHandler when an unexpected error
* occurs, this usually represents a bug in Daffodil
*/
- class DaffodilUnhandledSAXException(description: String, cause: Exception)
- extends SAXException(description, cause)
+ class DaffodilUnhandledSAXException(description: String, cause: Throwable)
+ extends SAXException(description, new Exception(cause)) {
+ def this(msg: String) = this(msg, null)
+
+ def this(cause: Throwable) = this(null, cause)
Review Comment:
I don't know the use case where we'd have an exception with no message, but
isn't null the expected thing if you have no message passed in to the exception
and no cause messaged passed in with the cause? As in the case below?
```scala
@Test def
testDaffodilUnhandledSAXException_creation_onlyCauseNoCauseMessage(): Unit = {
val expectedException = new IllegalArgumentException()
val actualException = new
DaffodilUnhandledSAXException(expectedException)
// when the detailMessage is null as is the case when no message is
passed in,
// getMessage returns the detailMessage from the embedded exception
assertNull(actualException.getMessage)
assertEquals(expectedException, actualException.getCause)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]