forked from Mirrors/keyoxide-web
fix: allow toJSON to fail
This commit is contained in:
parent
cf78f90251
commit
5928e4d28d
1 changed files with 14 additions and 2 deletions
|
@ -128,7 +128,13 @@ router.get('/fetch',
|
|||
data = await doVerification(data)
|
||||
}
|
||||
|
||||
data = data.toJSON()
|
||||
try {
|
||||
data = data.toJSON()
|
||||
} catch (error) {
|
||||
data = {
|
||||
errors: [error.message]
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Validate JSON
|
||||
|
@ -162,7 +168,13 @@ router.get('/verify',
|
|||
// Do verification
|
||||
let data = await doVerification(profile)
|
||||
|
||||
data = data.toJSON()
|
||||
try {
|
||||
data = data.toJSON()
|
||||
} catch (error) {
|
||||
data = {
|
||||
errors: [error.message]
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Validate JSON
|
||||
|
|
Loading…
Reference in a new issue