Skip to content

Commit

Permalink
fix: error handling and update copy
Browse files Browse the repository at this point in the history
  • Loading branch information
binoy14 committed Aug 14, 2024
1 parent b923c0d commit 89ee33f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ describe('undeployStudioAction', () => {
await undeployStudioAction({} as CliCommandArguments<Record<string, unknown>>, mockContext)

expect(mockContext.output.print).toHaveBeenCalledWith(
'Your project has not been assigned a studio hostname.',
'Your project has not been assigned a studio hostname',
)
expect(mockContext.output.print).toHaveBeenCalledWith(
'or you do not have studioHost set in sanity.cli.js or sanity.cli.ts.',
)
expect(mockContext.output.print).toHaveBeenCalledWith('Nothing to undeploy.')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export async function getOrCreateUserApplicationFromConfig({
spinner.fail()
// if the name is taken, it should return a 409 so we relay to the user
if ([402, 409].includes(e?.statusCode)) {
throw new Error(e?.response?.body?.message) || 'Bad request' // just in case
throw new Error(e?.response?.body?.message || 'Bad request') // just in case
}

debug('Error creating user application from config', e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default async function undeployStudioAction(
spinner.succeed()

if (!userApplication) {
output.print('Your project has not been assigned a studio hostname.')
output.print('Your project has not been assigned a studio hostname')
output.print('or you do not have studioHost set in sanity.cli.js or sanity.cli.ts.')
output.print('Nothing to undeploy.')
return
}
Expand Down

0 comments on commit 89ee33f

Please sign in to comment.