Skip to content

Commit

Permalink
fix: updated error message for attempting to deploy a site with a bad… (
Browse files Browse the repository at this point in the history
#6884)

* fix: updated error message for attempting to deploy a site with a bad auth key

Co-authored-by: Ben Hancock <benhancock859@gmail.com>

* fix: updated error message for deploying with bad auth key to be more precise

Co-authored-by: Ben Hancock <benhancock859@gmail.com>

* chore: remove `ts-expect-error`s in `get-site`

Co-authored-by: Ben Hancock <benhancock859@gmail.com>

---------

Co-authored-by: Ben Hancock <benhancock859@gmail.com>
dylanspyer and benhancock authored Oct 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 622098e commit 9cb44c5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/get-site.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { error } from './command-helpers.js'
import { APIError, error } from './command-helpers.js'

// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
export const getSiteByName = async (api, siteName) => {
@@ -12,7 +12,11 @@ export const getSiteByName = async (api, siteName) => {
}

return siteFoundByName
} catch {
error('Site not found. Please rerun "netlify link"')
} catch (error_) {
if ((error_ as APIError).status === 401) {
error(`${(error_ as APIError).message}: could not retrieve site`)
} else {
error('Site not found. Please rerun "netlify link"')
}
}
}

0 comments on commit 9cb44c5

Please sign in to comment.