Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated error message for attempting to deploy a site with a bad… #6884

Merged
merged 8 commits into from
Oct 25, 2024
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) => {
Expand All @@ -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"')
}
}
}
Loading