Skip to content

Commit

Permalink
Unify how asset upload errors are rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmengo committed Jan 15, 2025
1 parent 3c10c59 commit 9cf51e3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/theme/src/cli/utilities/theme-uploader.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -432,10 +432,8 @@ async function handleFailedUploads(
function reportFailedUploads(uploadResults: Map<string, Result>) {
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?.map((err) => `-${err}`).join('\n') ?? 'File upload failed'
renderThrownError(key, new Error(errorMessage))
}
}
}

0 comments on commit 9cf51e3

Please sign in to comment.