Skip to content

Commit 56b0d57

Browse files
committed
[javakit] exception description should include type, otherwise hard to
act on
1 parent 54c437c commit 56b0d57

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Sources/JavaKit/Exceptions/Throwable+Error.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
// Translate all Java Throwable instances in a Swift error.
16-
extension Throwable: Error, CustomStringConvertible {
17-
public var description: String {
18-
return getMessage()
19-
}
16+
extension Throwable: Error {
2017
}
2118

2219
extension JavaClass<Throwable> {

Tests/JavaKitTests/BasicRuntimeTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BasicRuntimeTests: XCTestCase {
5656
do {
5757
_ = try URL("bad url", environment: environment)
5858
} catch {
59-
XCTAssert(String(describing: error) == "no protocol: bad url")
59+
XCTAssertEqual(String(describing: error), "java.net.MalformedURLException: no protocol: bad url")
6060
}
6161
}
6262

@@ -73,7 +73,7 @@ class BasicRuntimeTests: XCTestCase {
7373
do {
7474
_ = try JavaClass<Nonexistent>(environment: environment)
7575
} catch {
76-
XCTAssertEqual(String(describing: error), "org/swift/javakit/Nonexistent")
76+
XCTAssertEqual(String(describing: error), "java.lang.NoClassDefFoundError: org/swift/javakit/Nonexistent")
7777
}
7878
}
7979

0 commit comments

Comments
 (0)