File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -372,14 +372,11 @@ public function processAllEvents(): void
372372 */
373373 private function dispatchMessage (string $ message , ?Session $ session = null )
374374 {
375- // responses come as json string
376- $ response = \json_decode ($ message , true );
377-
378- // if json not valid throw exception
379- $ jsonError = \json_last_error ();
380- if (\JSON_ERROR_NONE !== $ jsonError ) {
375+ try {
376+ $ response = \json_decode ($ message , true , 512 , \JSON_THROW_ON_ERROR );
377+ } catch (\JsonException $ e ) {
381378 if ($ this ->isStrict ()) {
382- throw new CannotReadResponse (\sprintf ( 'Response from chrome remote interface is not a valid json response. JSON error: %s ' , $ jsonError ) );
379+ throw new CannotReadResponse ('Response from chrome remote interface is not a valid JSON response ' , 0 , $ e );
383380 }
384381
385382 return false ;
You can’t perform that action at this time.
0 commit comments