Skip to content

Commit

Permalink
[3.68] Avoid process exit when failing to delete a file from the remo…
Browse files Browse the repository at this point in the history
…te theme
  • Loading branch information
frandiox authored and karreiro committed Oct 9, 2024
1 parent 0ab8a9c commit 7033292
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-worms-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/theme': patch
---

Avoid process exit when failing to delete a file from the remote theme.
12 changes: 8 additions & 4 deletions packages/theme/src/cli/utilities/theme-uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7033292

Please sign in to comment.