Skip to content

Commit

Permalink
fix: reject an Error not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Plopix committed Dec 22, 2023
1 parent 7f82053 commit 17fe54b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-points-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crystallize/import-utilities': patch
---

reject an Error not a string
22 changes: 10 additions & 12 deletions src/bootstrap-tenant/bootstrapper/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export interface AreaWarning {
export interface AreaError {
message: string
code:
| 'UPLOAD_FAILED'
| 'SHAPE_ID_MISSING'
| 'CANNOT_HANDLE_SHAPE'
| 'CANNOT_HANDLE_ITEM'
| 'CANNOT_HANDLE_PRODUCT'
| 'CANNOT_HANDLE_ITEM_RELATION'
| 'PARENT_FOLDER_NOT_FOUND'
| 'OTHER'
| 'UPLOAD_FAILED'
| 'SHAPE_ID_MISSING'
| 'CANNOT_HANDLE_SHAPE'
| 'CANNOT_HANDLE_ITEM'
| 'CANNOT_HANDLE_PRODUCT'
| 'CANNOT_HANDLE_ITEM_RELATION'
| 'PARENT_FOLDER_NOT_FOUND'
| 'OTHER'
item?: JSONItem
}

Expand Down Expand Up @@ -233,10 +233,8 @@ export class FileUploadManager extends KillableWorker {
}

if (isLastAttempt) {
const msg = fileNotFound
? `Got 404 for file "${item.url}"`
: e.message || JSON.stringify(e, null, 1)
item.reject?.(msg)
const msg = fileNotFound ? `Got 404 for file "${item.url}"` : e.message || JSON.stringify(e, null, 1)
item.reject?.(new Error(msg))
removeWorker(item)
} else {
item.failCount++
Expand Down

0 comments on commit 17fe54b

Please sign in to comment.