mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
* refactor: move OAuthCallbackError to errors file * refactor: improve pkce handling * feat(provider): re-introduce state to provider options * docs(provider): mention protection options "state" and "none" * docs(provider): document state property deprecation * fix: only add code_verifier param if protection is pkce * docs: explain state deprecation better * chore: unify string
40 lines
840 B
JavaScript
40 lines
840 B
JavaScript
export class UnknownError extends Error {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'UnknownError'
|
|
}
|
|
|
|
toJSON () {
|
|
return {
|
|
error: {
|
|
name: this.name,
|
|
message: this.message
|
|
// stack: this.stack
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export class CreateUserError extends UnknownError {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'CreateUserError'
|
|
}
|
|
}
|
|
|
|
// 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.
|
|
export class AccountNotLinkedError extends UnknownError {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'AccountNotLinkedError'
|
|
}
|
|
}
|
|
|
|
export class OAuthCallbackError extends UnknownError {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = 'OAuthCallbackError'
|
|
}
|
|
}
|