Skip to content

Commit 062450d

Browse files
authored
[10.x] Display error message if json_encode() fails (#48856)
* 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
1 parent aeb2849 commit 062450d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Queue/Queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected function createPayload($job, $queue, $data = '')
107107

108108
if (json_last_error() !== JSON_ERROR_NONE) {
109109
throw new InvalidPayloadException(
110-
'Unable to JSON encode payload. Error code: '.json_last_error(), $value
110+
'Unable to JSON encode payload. Error ('.json_last_error().'): '.json_last_error_msg(), $value
111111
);
112112
}
113113

0 commit comments

Comments
 (0)