mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +00:00
Error explanation for unauthorized domain access (#1059)
This commit is contained in:
committed by
Leo Lamprecht
parent
c4969b17dd
commit
a6af5c8696
9
errors/unauthorized-domain.md
Normal file
9
errors/unauthorized-domain.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Not authorized to access domain
|
||||
|
||||
#### Why This Error Occurred
|
||||
|
||||
You tried to add or update a domain's configuration, but you don't have permission to modify the domain.
|
||||
|
||||
#### Possible Ways to Fix It
|
||||
|
||||
If you or your team owns the domain, then you are most likely in the wrong context. Use `now switch` to select the team or user that owns the domain.
|
||||
@@ -1,4 +1,6 @@
|
||||
// Ours
|
||||
const error = require('../../../util/output/error')
|
||||
const exit = require('../../../util/exit')
|
||||
const Now = require('.')
|
||||
|
||||
module.exports = class DomainRecords extends Now {
|
||||
@@ -90,9 +92,11 @@ module.exports = class DomainRecords extends Now {
|
||||
new Error(body.error ? body.error.message : 'Unknown error')
|
||||
)
|
||||
} else if (res.status === 403) {
|
||||
const err = new Error(`Not authorized to access the domain "${domain}"`)
|
||||
err.userError = true
|
||||
return bail(err)
|
||||
console.error(error({
|
||||
message: `Not authorized to access domain ${domain}`,
|
||||
slug: 'unauthorized-domain'
|
||||
}))
|
||||
await exit(1)
|
||||
} else if (res.status === 404) {
|
||||
let err
|
||||
|
||||
@@ -125,9 +129,11 @@ module.exports = class DomainRecords extends Now {
|
||||
|
||||
const body = await res.json()
|
||||
if (res.status === 403) {
|
||||
const err = new Error(`Not authorized to access domain ${domain}`)
|
||||
err.userError = true
|
||||
return bail(err)
|
||||
console.error(error({
|
||||
message: `Not authorized to access domain ${domain}`,
|
||||
slug: 'unauthorized-domain'
|
||||
}))
|
||||
await exit(1)
|
||||
} else if (res.status === 404) {
|
||||
let err
|
||||
|
||||
|
||||
@@ -729,7 +729,7 @@ module.exports = class Now extends EventEmitter {
|
||||
)}.`
|
||||
)
|
||||
} else {
|
||||
err = new Error(`Not authorized to access domain ${name}`)
|
||||
err = new Error(`Not authorized to access domain ${name} http://err.sh/now-cli/unauthorized-domain`)
|
||||
}
|
||||
|
||||
err.userError = true
|
||||
|
||||
Reference in New Issue
Block a user