diff --git a/.changeset/nine-elephants-pump.md b/.changeset/nine-elephants-pump.md new file mode 100644 index 0000000..9878d79 --- /dev/null +++ b/.changeset/nine-elephants-pump.md @@ -0,0 +1,5 @@ +--- +'@crystallize/import-utilities': patch +--- + +Add more visibility on uploading error diff --git a/src/bootstrap-tenant/bootstrapper/items/createFilesInput.ts b/src/bootstrap-tenant/bootstrapper/items/createFilesInput.ts index 48e8a3c..c33b3eb 100644 --- a/src/bootstrap-tenant/bootstrapper/items/createFilesInput.ts +++ b/src/bootstrap-tenant/bootstrapper/items/createFilesInput.ts @@ -22,11 +22,11 @@ export async function createFilesInput( // Store the values so that we don't re-upload again during import file.key = uploadResult.key } - } catch (e) { + } catch (e: any) { onUpdate({ error: { code: 'UPLOAD_FAILED', - message: `Could not upload file "${JSON.stringify(file)}"`, + message: `Could not upload file "${JSON.stringify(file)}". Reason: ${e.message ?? 'unknown'}`, }, }) } diff --git a/src/bootstrap-tenant/bootstrapper/items/createImagesInput.ts b/src/bootstrap-tenant/bootstrapper/items/createImagesInput.ts index 0b26154..9e2e407 100644 --- a/src/bootstrap-tenant/bootstrapper/items/createImagesInput.ts +++ b/src/bootstrap-tenant/bootstrapper/items/createImagesInput.ts @@ -27,11 +27,11 @@ export async function createImagesInput( image.key = uploadResult.key image.mimeType = uploadResult.mimeType } - } catch (e) { + } catch (e: any) { onUpdate({ error: { code: 'UPLOAD_FAILED', - message: `Could not upload image "${JSON.stringify(image)}"`, + message: `Could not upload image "${JSON.stringify(image)}". Reason: ${e.message ?? 'unknown'}`, }, }) } diff --git a/src/bootstrap-tenant/bootstrapper/items/createVideosInput.ts b/src/bootstrap-tenant/bootstrapper/items/createVideosInput.ts index 1907e45..03f8cc8 100644 --- a/src/bootstrap-tenant/bootstrapper/items/createVideosInput.ts +++ b/src/bootstrap-tenant/bootstrapper/items/createVideosInput.ts @@ -23,11 +23,11 @@ export async function createVideosInput( // Store the values so that we don't re-upload again during import video.key = uploadResult.key } - } catch (e) { + } catch (e: any) { onUpdate({ error: { code: 'UPLOAD_FAILED', - message: `${e} - Could not upload video "${JSON.stringify(video)}"`, + message: `Could not upload video "${JSON.stringify(video)}". Reason: ${e.message ?? 'unknown'}`, }, }) }