Skip to content

Commit 3d3c540

Browse files
feat: adjust status handling to new behaviour (#50)
The backend will return NOT_FOUND as statusCode 200 from now on
1 parent 3db0a62 commit 3d3c540

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/executionFiles/bridges/bridge.execute.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@lifinance/types'
1616
import { getProvider } from '../../utils/getProvider'
1717
import { switchChain } from '../switchChain'
18-
import { LifiErrorCodes, ServerError } from '../../utils/errors'
18+
import { ServerError } from '../../utils/errors'
1919

2020
export class BridgeExecutionManager {
2121
shouldContinue = true
@@ -158,7 +158,7 @@ export class BridgeExecutionManager {
158158
} catch (e: any) {
159159
statusManager.updateProcess(step, waitForTxProcess.id, 'FAILED', {
160160
errorMessage: 'Failed waiting',
161-
errorCode: e.code,
161+
errorCode: e?.code,
162162
})
163163
statusManager.updateExecution(step, 'FAILED')
164164
throw e
@@ -201,18 +201,15 @@ export class BridgeExecutionManager {
201201
txHash
202202
)
203203
} catch (e: any) {
204-
// until the source transaction is mined the API will return a 404, which is not really an error
205-
if (e.code !== LifiErrorCodes.notFound) {
206-
console.debug('Fetching status from backend failed', e)
207-
}
208-
204+
console.debug('Fetching status from backend failed', e)
209205
return resolve(undefined)
210206
}
211207

212208
switch (statusResponse.status) {
213209
case 'DONE':
214210
return resolve(statusResponse)
215211
case 'PENDING':
212+
case 'NOT_FOUND':
216213
return resolve(undefined)
217214
case 'FAILED':
218215
default:

0 commit comments

Comments
 (0)