File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,24 @@ public function __construct(
5555 public function afterDispatch (Rest $ subject , $ result , RequestInterface $ request )
5656 {
5757 if ($ this ->config ->isEnabled ()) {
58- $ responseCode = (string )$ result ->getStatusCode ();
59- $ resposeBody = $ result ->getContent ();
60- $ resposeBody = trim ($ resposeBody , '" ' );
61- $ responseDateTime = $ this ->date ->gmtDate ();
58+ $ exceptions = $ result ->getException ();
59+
60+ if (!empty ($ exceptions )) {
61+ $ responseCode = '' ;
62+ $ resposeBody = '' ;
63+ foreach ($ exceptions as $ exception ) {
64+ $ responseCode .= (string )$ exception ->getHttpCode () . ' ' ;
65+ $ resposeBody .= $ exception ->getMessage () . ' ' ;
66+ }
67+ $ responseCode = rtrim ($ responseCode );
68+ $ resposeBody = rtrim ($ resposeBody );
69+ } else {
70+ $ responseCode = (string )$ result ->getStatusCode ();
71+ $ resposeBody = $ result ->getContent ();
72+ $ resposeBody = trim ($ resposeBody , '" ' );
73+ }
6274
75+ $ responseDateTime = $ this ->date ->gmtDate ();
6376 $ this ->logHandle ->after ($ responseCode , $ resposeBody , $ responseDateTime );
6477 }
6578 return $ result ;
You can’t perform that action at this time.
0 commit comments