I would like to log context of exception as current data in some variables. But repost() handler which I use to log exceptions does not support context parameters. Is there any other way to do it?
try {
// process the points
$customerPointsService->subtractPointsForRewardReservation($customerReward);
} catch(\Throwable $e) {
report($e);
// I would like to log also some variable values
return $this->sendJsonErrorWithCorrectStatusCode("Customer point subtraction failed.", [], 422);
}
Create a custom exception: