diff --git a/.changeset/stupid-phones-try.md b/.changeset/stupid-phones-try.md new file mode 100644 index 0000000000..555d5d0cf8 --- /dev/null +++ b/.changeset/stupid-phones-try.md @@ -0,0 +1,5 @@ +--- +'@shopify/theme': minor +--- + +Unify how asset upload errors are reported in the `theme dev` command diff --git a/packages/theme/src/cli/utilities/theme-uploader.ts b/packages/theme/src/cli/utilities/theme-uploader.ts index 1069696561..d2e9c6e2c7 100644 --- a/packages/theme/src/cli/utilities/theme-uploader.ts +++ b/packages/theme/src/cli/utilities/theme-uploader.ts @@ -1,12 +1,12 @@ import {partitionThemeFiles} from './theme-fs.js' import {rejectGeneratedStaticAssets} from './asset-checksum.js' import {renderTasksToStdErr} from './theme-ui.js' -import {createSyncingCatchError} from './errors.js' +import {createSyncingCatchError, renderThrownError} from './errors.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 {Task} from '@shopify/cli-kit/node/ui' -import {outputDebug, outputInfo, outputNewline, outputWarn} from '@shopify/cli-kit/node/output' +import {outputDebug} from '@shopify/cli-kit/node/output' interface UploadOptions { nodelete?: boolean @@ -432,10 +432,8 @@ async function handleFailedUploads( function reportFailedUploads(uploadResults: Map) { for (const [key, result] of uploadResults.entries()) { if (!result.success) { - const errorMessage = result.errors?.asset?.map((err) => `-${err}`).join('\n') - outputWarn(`Failed to upload file ${key}:`) - outputInfo(`${errorMessage}`) - outputNewline() + const errorMessage = result.errors?.asset?.join('\n') ?? 'File upload failed' + renderThrownError(key, new Error(errorMessage)) } } }