[CORDA-2212] Better error on empty Party name fuzzy matching (#4220)

* typo - no matching
This commit is contained in:
Konstantinos Chalkias 2018-11-12 19:34:21 +00:00 committed by GitHub
parent 1c012f6403
commit 71117ebdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -351,7 +351,11 @@ object JacksonSupport {
val nameMatches = mapper.partiesFromName(parser.text)
return when {
nameMatches.isEmpty() -> {
val publicKey = parser.readValueAs<PublicKey>()
val publicKey = try {
parser.readValueAs<PublicKey>()
} catch (e: Exception) {
throw JsonParseException(parser, "No matching Party found, then tried to directly deserialise ${parser.text} as a PublicKey with no success", e)
}
mapper.partyFromKey(publicKey)
?: throw JsonParseException(parser, "Could not find a Party with key ${publicKey.toStringShort()}")
}

View File

@ -1,7 +1,6 @@
package net.corda.node.services.api
import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party
import net.corda.core.identity.PartyAndCertificate
import net.corda.core.internal.CertRole
import net.corda.core.node.services.IdentityService