Skip to content

Commit 20826de

Browse files
committed
fix bug with promise.assemblyId
1 parent 7e024e2 commit 20826de

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/util.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTTPError, Transloadit } from '../src/Transloadit'
1+
import { RequestError, Transloadit } from '../src/Transloadit'
22

33
export const createProxy = (transloaditInstance: Transloadit) => {
44
return new Proxy(transloaditInstance, {
@@ -14,8 +14,8 @@ export const createProxy = (transloaditInstance: Transloadit) => {
1414
}
1515

1616
// @ts-expect-error any
17-
return result.catch((err) => {
18-
if (err instanceof Error && 'cause' in err && err.cause instanceof HTTPError) {
17+
const newPromise = result.catch((err) => {
18+
if (err instanceof Error && 'cause' in err && err.cause instanceof RequestError) {
1919
if (err.cause.request) {
2020
Object.defineProperty(err.cause.request, 'toJSON', {
2121
value: () => undefined,
@@ -37,6 +37,12 @@ export const createProxy = (transloaditInstance: Transloadit) => {
3737
}
3838
throw err
3939
})
40+
41+
// pass on the assembly id if present
42+
if (result?.assemblyId != null) {
43+
Object.assign(newPromise, { assemblyId: result.assemblyId })
44+
}
45+
return newPromise
4046
}
4147
}
4248

0 commit comments

Comments
 (0)