Skip to content

Commit 9cb44c5

Browse files
dylanspyerbenhancock
andauthoredOct 25, 2024··
fix: updated error message for attempting to deploy a site with a bad… (#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>
1 parent 622098e commit 9cb44c5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/utils/get-site.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { error } from './command-helpers.js'
1+
import { APIError, error } from './command-helpers.js'
22

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

1414
return siteFoundByName
15-
} catch {
16-
error('Site not found. Please rerun "netlify link"')
15+
} catch (error_) {
16+
if ((error_ as APIError).status === 401) {
17+
error(`${(error_ as APIError).message}: could not retrieve site`)
18+
} else {
19+
error('Site not found. Please rerun "netlify link"')
20+
}
1721
}
1822
}

0 commit comments

Comments
 (0)
Please sign in to comment.