mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
* chore: fix casing of OAuth * refacotr: simplify default callbacks lib file * refactor: use native URL instead of string concats * refactor: move redirect to res.redirect, done to res.end * refactor: move options to req * refactor: improve IntelliSense, name all functions * fix(lint): fix lint errors * refactor: remove jwt-decode dependency * refactor: refactor some callbacks to Promises * revert: "refactor: use native URL instead of string concats" Refs: 690c55b04089e4f3157424c816d43ee4cecb77a0 * chore: misc changes Co-authored-by: Balazs Orban <balazs@nhi.no>
42 lines
837 B
JavaScript
42 lines
837 B
JavaScript
class UnknownError extends Error {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'UnknownError'
|
|
this.message = message
|
|
}
|
|
|
|
toJSON () {
|
|
return {
|
|
error: {
|
|
name: this.name,
|
|
message: this.message
|
|
// stack: this.stack
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class CreateUserError extends UnknownError {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'CreateUserError'
|
|
this.message = message
|
|
}
|
|
}
|
|
|
|
// Thrown when an Email address is already associated with an account
|
|
// but the user is trying an OAuth account that is not linked to it.
|
|
class AccountNotLinkedError extends UnknownError {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'AccountNotLinkedError'
|
|
this.message = message
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
UnknownError,
|
|
CreateUserError,
|
|
AccountNotLinkedError
|
|
}
|