Skip to content

Commit b625990

Browse files
committed
fixup! Translate spend errors from lib to InsufficientFundsError
1 parent 71c03e4 commit b625990

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/MoneroEngine.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
import { add, div, eq, gte, lt, sub } from 'biggystring'
6-
import { asMaybe, asObject, asValue } from 'cleaners'
76
import type { Disklet } from 'disklet'
87
import {
98
EdgeCorePluginOptions,
@@ -630,14 +629,11 @@ export class MoneroEngine implements EdgeCurrencyEngine {
630629
},
631630
options
632631
)
633-
} catch (error: any) {
634-
if (
635-
asMaybe(
636-
asObject({
637-
message: asValue('Not enough spendables')
638-
})
639-
)(error) != null
640-
) {
632+
} catch (error: unknown) {
633+
if (!(error instanceof Error)) {
634+
throw new Error(String(error))
635+
}
636+
if (error.message === 'Not enough spendables') {
641637
throw new InsufficientFundsError({
642638
tokenId: PRIMARY_CURRENCY_TOKEN_ID
643639
})

0 commit comments

Comments
 (0)