From 8943d8b8acca7586db69f658fb3f63f147338753 Mon Sep 17 00:00:00 2001 From: Muhammad Fadli Date: Fri, 21 Apr 2023 12:12:10 +0700 Subject: [PATCH] - fix error metro --- src/helper/irs-api.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 8d23673..1189aba 100644 --- a/src/helper/irs-api.ts +++ b/src/helper/irs-api.ts @@ -130,12 +130,24 @@ export const doTransaction = async ( console.log('restransini', res); console.log('restransini1', res.status); if (res.data.includes('Saldo anda tidak mencukupi')) { - throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; + throw new HttpException( + { + statusCode: HttpStatus.INTERNAL_SERVER_ERROR, + error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali', + }, + HttpStatus.INTERNAL_SERVER_ERROR, + ); } else { return res.data; } } catch (e) { - throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; + throw new HttpException( + { + statusCode: HttpStatus.INTERNAL_SERVER_ERROR, + error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali', + }, + HttpStatus.INTERNAL_SERVER_ERROR, + ); } } catch (err) {