@@ -84,16 +84,30 @@ public function setContextAttribute(array $value)
84
84
if (!empty ($ value ['exception ' ])) {
85
85
$ exception = $ value ['exception ' ];
86
86
if (get_class ($ exception ) === \Exception::class
87
- || is_subclass_of ($ exception , \Exception::class)) {
87
+ || is_subclass_of ($ exception , \Exception::class)
88
+ || strpos (get_class ($ exception ), "Exception " ) !== false ) {
88
89
$ newexception = [];
89
- $ newexception ['class ' ] = get_class ($ exception );
90
- $ newexception ['message ' ] = $ exception ->getMessage ();
91
- $ newexception ['code ' ] = $ exception ->getCode ();
92
- $ newexception ['file ' ] = $ exception ->getFile ();
93
- $ newexception ['line ' ] = $ exception ->getLine ();
94
- $ newexception ['trace ' ] = $ exception ->getTrace ();
95
- $ newexception ['previous ' ] = $ exception ->getPrevious ();
96
-
90
+ if (method_exists ($ exception , 'getMessage ' )) {
91
+ $ newexception ['message ' ] = $ exception ->getMessage ();
92
+ }
93
+ if (method_exists ($ exception , 'getCode ' )) {
94
+ $ newexception ['code ' ] = $ exception ->getCode ();
95
+ }
96
+ if (method_exists ($ exception , 'getFile ' )) {
97
+ $ newexception ['file ' ] = $ exception ->getFile ();
98
+ }
99
+ if (method_exists ($ exception , 'getLine ' )) {
100
+ $ newexception ['line ' ] = $ exception ->getLine ();
101
+ }
102
+ if (method_exists ($ exception , 'getTrace ' )) {
103
+ $ newexception ['trace ' ] = $ exception ->getTrace ();
104
+ }
105
+ if (method_exists ($ exception , 'getPrevious ' )) {
106
+ $ newexception ['previous ' ] = $ exception ->getPrevious ();
107
+ }
108
+ if (method_exists ($ exception , 'getSeverity ' )) {
109
+ $ newexception ['severity ' ] = $ exception ->getSeverity ();
110
+ }
97
111
$ value ['exception ' ] = $ newexception ;
98
112
}
99
113
}
0 commit comments