Throw exception in catch block to ensure that the code execution / flowed stops

- This to prevent broken data to be entered into tables
This commit is contained in:
Afiq Hamzah
2024-08-01 14:50:51 +08:00
parent f4f0276a1e
commit c48ffc22c8
2 changed files with 11 additions and 0 deletions
@@ -116,6 +116,8 @@ class BayaranController extends Controller
} catch (\Exception $e) {
OnlineTransactionLoggerService::logs($bill['id'], $paymentArray, $e->getMessage(), TransactionOnlineStatus::INITIALIZED_TRANSACTION);
throw $e;
}
try {
@@ -130,6 +132,8 @@ class BayaranController extends Controller
} catch (\Exception $e) {
OnlineTransactionLoggerService::logs($bill['id'], $paymentArray, $e->getMessage(), TransactionOnlineStatus::UPDATED_TAG_PORTAL);
throw $e;
}
return true;
+7
View File
@@ -70,6 +70,8 @@ class BillplzService
OnlineTransactionLoggerService::logs( null, $composed_data, $e->getMessage(), TransactionOnlineStatus::BILL_CREATED);
};
throw $e;
}
}
@@ -85,6 +87,8 @@ class BillplzService
} catch(\Exception $e){
OnlineTransactionLoggerService::logs($request['billplz']['id'], $request, $e->getMessage(), TransactionOnlineStatus::UPDATE_TRANSACTION_REDIRECT);
throw $e;
}
}
@@ -99,6 +103,8 @@ class BillplzService
} catch (\Exception $e) {
OnlineTransactionLoggerService::logs($request['billplz']['id'], $request, $e->getMessage(), TransactionOnlineStatus::UPDATE_TRANSACTION_CALLBACK);
throw $e;
}
}
@@ -176,6 +182,7 @@ class BillplzService
} catch (\Throwable $th) {
logger()->error('Error when querying billplz id : ' . $billId);
logger()->error($th->getMessage());
throw $th;
}
}
}