Skip to content

Commit

Permalink
improves error message from importParticipant RPC (#5402)
Browse files Browse the repository at this point in the history
includes name of conflicting identity in error message if the request tries to
import an identity that already exists in the database
  • Loading branch information
hughy authored Sep 20, 2024
1 parent a487c5d commit a4e1448
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ironfish/src/rpc/routes/wallet/multisig/importParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ routes.register<typeof ImportParticipantRequestSchema, ImportParticipantResponse
)
}

if (
await context.wallet.walletDb.getMultisigIdentity(
Buffer.from(request.data.identity, 'hex'),
)
) {
const existingIdentity = await context.wallet.walletDb.getMultisigIdentity(
Buffer.from(request.data.identity, 'hex'),
)
if (existingIdentity) {
throw new RpcValidationError(
`Multisig identity ${request.data.identity} already exists`,
`Multisig identity ${request.data.identity} already exists with the name ${existingIdentity.name}`,
400,
)
}
Expand Down

0 comments on commit a4e1448

Please sign in to comment.