Skip to content
Draft
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/utils/command-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,18 @@ export const pollForToken = async ({
return logAndThrowError('Could not retrieve access token')
}
return accessToken
} catch (error_) {
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
if (error_.name === 'TimeoutError') {
} catch (error) {
if (error instanceof Error && error.name === 'TimeoutError') {
return logAndThrowError(
`Timed out waiting for authorization. If you do not have a ${chalk.bold.greenBright(
'Netlify',
)} account, please create one at ${chalk.magenta(
'https://app.netlify.com/signup',
)}, then run ${chalk.cyanBright('netlify login')} again.`,
)
} else {
return logAndThrowError(error_)
}

return logAndThrowError(error)
} finally {
spinner.stop()
spinner.clear()
Expand Down
Loading