Skip to content

Commit

Permalink
[10.x] Display error message if json_encode() fails (#48856)
Browse files Browse the repository at this point in the history
* Display error message if json_encode() fails

Adding the error code to the exception isn't useful. Instead, the error message can give details about the problem.

* Added error code as suggested

* Fixed coding style issue
  • Loading branch information
aimeos authored Dec 11, 2023
1 parent aeb2849 commit 062450d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function createPayload($job, $queue, $data = '')

if (json_last_error() !== JSON_ERROR_NONE) {
throw new InvalidPayloadException(
'Unable to JSON encode payload. Error code: '.json_last_error(), $value
'Unable to JSON encode payload. Error ('.json_last_error().'): '.json_last_error_msg(), $value
);
}

Expand Down

0 comments on commit 062450d

Please sign in to comment.