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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user