mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-01-11 15:29:49 -05:00
throw correct error if takeOffer() fails
This commit is contained in:
parent
f34d380711
commit
6bd9f29063
@ -1062,8 +1062,9 @@ export default class HavenoClient {
|
||||
.setOfferId(offerId)
|
||||
.setPaymentAccountId(paymentAccountId);
|
||||
if (amount) request.setAmount(amount.toString());
|
||||
HavenoUtils.log(0, "Taking offer with taker amount: " + amount);
|
||||
return (await this._tradesClient.takeOffer(request, {password: this._password})).getTrade()!;
|
||||
const resp = await this._tradesClient.takeOffer(request, {password: this._password});
|
||||
if (resp.getTrade()) return resp.getTrade()!;
|
||||
throw new HavenoError(resp.getFailureReason()?.getDescription()!, resp.getFailureReason()?.getAvailabilityResult());
|
||||
} catch (e: any) {
|
||||
throw new HavenoError(e.message, e.code);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user