diff options
author | Florian Dold <florian@dold.me> | 2022-03-23 13:11:36 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-23 13:11:36 +0100 |
commit | c539d1803c1376cba0831be64866b6d2c1652403 (patch) | |
tree | 20104848bee6fff74ab40d0f8be646d63c6ef9d5 /packages/taler-wallet-core/src/errors.ts | |
parent | 739c2f933770206b173a9b3cbafa79ee6048ff9d (diff) | |
download | wallet-core-c539d1803c1376cba0831be64866b6d2c1652403.tar.xz |
wallet: address crypto worker hang and warning about worker termination
Diffstat (limited to 'packages/taler-wallet-core/src/errors.ts')
-rw-r--r-- | packages/taler-wallet-core/src/errors.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/packages/taler-wallet-core/src/errors.ts b/packages/taler-wallet-core/src/errors.ts index 07a01a760..eda5444bf 100644 --- a/packages/taler-wallet-core/src/errors.ts +++ b/packages/taler-wallet-core/src/errors.ts @@ -161,32 +161,3 @@ export function getErrorDetailFromException(e: any): TalerErrorDetail { ); return err; } - -/** - * Run an operation and call the onOpError callback - * when there was an exception or operation error that must be reported. - * The cause will be re-thrown to the caller. - */ -export async function guardOperationException<T>( - op: () => Promise<T>, - onOpError: (e: TalerErrorDetail) => Promise<void>, -): Promise<T> { - try { - return await op(); - } catch (e: any) { - if ( - e instanceof TalerError && - e.hasErrorCode(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED) - ) { - throw e; - } - const opErr = getErrorDetailFromException(e); - await onOpError(opErr); - throw TalerError.fromDetail( - TalerErrorCode.WALLET_PENDING_OPERATION_FAILED, - { - innerError: e.errorDetail, - }, - ); - } -} |