diff --git a/.changeset/rotten-worms-rush.md b/.changeset/rotten-worms-rush.md new file mode 100644 index 0000000000..caa5ba76ae --- /dev/null +++ b/.changeset/rotten-worms-rush.md @@ -0,0 +1,5 @@ +--- +'@shopify/theme': patch +--- + +Avoid process exit when failing to delete a file from the remote theme. diff --git a/packages/theme/src/cli/utilities/theme-uploader.ts b/packages/theme/src/cli/utilities/theme-uploader.ts index 61e2ae85a2..6f6bdd3bef 100644 --- a/packages/theme/src/cli/utilities/theme-uploader.ts +++ b/packages/theme/src/cli/utilities/theme-uploader.ts @@ -4,7 +4,7 @@ import {renderTasksToStdErr} from './theme-ui.js' import {AdminSession} from '@shopify/cli-kit/node/session' import {Result, Checksum, Theme, ThemeFileSystem} from '@shopify/cli-kit/node/themes/types' import {AssetParams, bulkUploadThemeAssets, deleteThemeAsset} from '@shopify/cli-kit/node/themes/api' -import {renderWarning, Task} from '@shopify/cli-kit/node/ui' +import {renderError, renderWarning, Task} from '@shopify/cli-kit/node/ui' import {outputDebug, outputInfo, outputNewline, outputWarn} from '@shopify/cli-kit/node/output' interface UploadOptions { @@ -127,9 +127,13 @@ function buildDeleteJob( const progress = {current: 0, total: orderedFiles.length} const promise = Promise.all( orderedFiles.map((file) => - deleteThemeAsset(theme.id, file.key, session).then(() => { - progress.current++ - }), + deleteThemeAsset(theme.id, file.key, session) + .catch((error) => { + renderError({headline: `Failed to delete file "${file.key}" from remote theme.`, body: error.message}) + }) + .finally(() => { + progress.current++ + }), ), ).then(() => { progress.current = progress.total