mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
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 = await doVerification(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
data = data.toJSON()
|
try {
|
||||||
|
data = data.toJSON()
|
||||||
|
} catch (error) {
|
||||||
|
data = {
|
||||||
|
errors: [error.message]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Validate JSON
|
// Validate JSON
|
||||||
|
@ -162,7 +168,13 @@ router.get('/verify',
|
||||||
// Do verification
|
// Do verification
|
||||||
let data = await doVerification(profile)
|
let data = await doVerification(profile)
|
||||||
|
|
||||||
data = data.toJSON()
|
try {
|
||||||
|
data = data.toJSON()
|
||||||
|
} catch (error) {
|
||||||
|
data = {
|
||||||
|
errors: [error.message]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Validate JSON
|
// Validate JSON
|
||||||
|
|
Loading…
Reference in a new issue