Skip to content

Commit e8f196a

Browse files
committed
Deduplicate error messages
1 parent f43c9bf commit e8f196a

File tree

1 file changed

+4
-4
lines changed
  • matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/rendezvous

1 file changed

+4
-4
lines changed

matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/rendezvous/Rendezvous.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class Rendezvous(
6161
// we rely on moshi validating the code and throwing exception if invalid JSON or algorithm doesn't match
6262
MatrixJsonParser.getMoshi().adapter(RendezvousCode::class.java).fromJson(code)
6363
} catch (a: Throwable) {
64-
throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)
65-
} ?: throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)
64+
throw RendezvousError("Malformed code", RendezvousFailureReason.InvalidCode)
65+
} ?: throw RendezvousError("Code is null", RendezvousFailureReason.InvalidCode)
6666

6767
// then we check that algorithm is supported
6868
if (!SecureRendezvousChannelAlgorithm.values().map { it.value }.contains(genericParsed.rendezvous.algorithm)) {
@@ -79,8 +79,8 @@ class Rendezvous(
7979
val supportedParsed = try {
8080
MatrixJsonParser.getMoshi().adapter(ECDHRendezvousCode::class.java).fromJson(code)
8181
} catch (a: Throwable) {
82-
throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)
83-
} ?: throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)
82+
throw RendezvousError("Malformed ECDH rendezvous code", RendezvousFailureReason.InvalidCode)
83+
} ?: throw RendezvousError("ECDH rendezvous code is null", RendezvousFailureReason.InvalidCode)
8484

8585
val transport = SimpleHttpRendezvousTransport(supportedParsed.rendezvous.transport.uri)
8686

0 commit comments

Comments
 (0)