From 9db0c6a71427d8403f88bfdab61cf783ece0a12c Mon Sep 17 00:00:00 2001 From: Fadli Date: Sun, 1 Jan 2023 16:23:27 +0700 Subject: [PATCH] - add error if data not found export transaction history --- src/transaction/transaction.service.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index c811487..18ffb86 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -2220,12 +2220,7 @@ export class TransactionService { - if (!data) { - return { - statusCode: HttpStatus.NOT_FOUND, - message: 'No data to export' - }; - } else { + try { let rows = []; // First create the array of keys/net_total so that we can sort it: @@ -2325,6 +2320,8 @@ export class TransactionService { //returning the path of file return File; + } catch (e) { + throw new HttpException('No data to export', HttpStatus.NOT_FOUND); } }