Include name/alias of already existing (pending) contact in error

This commit is contained in:
Nico Alt
2021-02-13 12:00:00 +00:00
parent 7fab97d26c
commit d095ba0b15
4 changed files with 35 additions and 8 deletions

View File

@@ -112,11 +112,13 @@ constructor(
return ctx.json(details)
} catch (e: ContactExistsException) {
ctx.status(FORBIDDEN_403)
val details = mapOf("error" to "CONTACT_EXISTS")
val details =
mapOf("error" to "CONTACT_EXISTS", "remoteAuthorName" to e.remoteAuthor.name)
return ctx.json(details)
} catch (e: PendingContactExistsException) {
ctx.status(FORBIDDEN_403)
val details = mapOf("error" to "PENDING_EXISTS")
val details =
mapOf("error" to "PENDING_EXISTS", "pendingContactAlias" to e.pendingContact.alias)
return ctx.json(details)
}
return ctx.json(pendingContact.output())