mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: add error handling for oauthVerify
This commit is contained in:
1 parent
8d0ec00536
commit
8430ce4428
1 file changed
+4
@@ -2,6 +2,7 @@ import { User } from '@linux-odyssey/models'
|
|||||||
|
|
||||||
export default async function oauthVerify(provider, profile, query, cb) {
|
export default async function oauthVerify(provider, profile, query, cb) {
|
||||||
process.nextTick(async () => {
|
process.nextTick(async () => {
|
||||||
|
try {
|
||||||
const email = profile.emails[0]?.value
|
const email = profile.emails[0]?.value
|
||||||
if (!email) {
|
if (!email) {
|
||||||
return cb(new Error('No email found'))
|
return cb(new Error('No email found'))
|
||||||
@@ -24,5 +25,8 @@ export default async function oauthVerify(provider, profile, query, cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return cb(null, user)
|
return cb(null, user)
|
||||||
|
} catch (err) {
|
||||||
|
return cb(err)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user