@@ -13,30 +13,23 @@ public function __construct(
1313 public readonly int $ status ,
1414 public readonly string $ url ,
1515 public readonly string $ method ,
16- public readonly ?Exception $ exception ,
17- public readonly ?string $ stack ,
18- public readonly string $ message ,
19- public readonly bool $ isLoggedToVault ,
20- public readonly bool $ isLoggedToApplication ,
2116 public readonly string $ exceptionName ,
17+ public readonly string $ exceptionMessage ,
18+ public readonly ?string $ stack ,
2219 ) {}
2320
2421 public static function fromArray (array $ data ): self
2522 {
26- $ exceptionData = Arr::get ($ data , 'Exception ' );
27- $ exception = $ exceptionData ? Exception::fromArray ($ exceptionData ) : null ;
23+ $ exceptionData = Arr::get ($ data , 'Exception ' , []);
2824
2925 return new self (
3026 errorCode: Arr::get ($ data , 'ErrorCode ' , '' ),
3127 status: Arr::get ($ data , 'Status ' , 0 ),
3228 url: Arr::get ($ data , 'URL ' , '' ),
3329 method: Arr::get ($ data , 'Method ' , '' ),
34- exception: $ exception ,
30+ exceptionName: Arr::get ($ exceptionData , 'Name ' , '' ),
31+ exceptionMessage: Arr::get ($ exceptionData , 'Message ' , '' ),
3532 stack: Arr::get ($ data , 'Stack ' ),
36- message: Arr::get ($ data , 'Message ' , '' ),
37- isLoggedToVault: Arr::get ($ data , 'IsLoggedToVault ' , false ),
38- isLoggedToApplication: Arr::get ($ data , 'IsLoggedToApplication ' , false ),
39- exceptionName: Arr::get ($ data , 'ExceptionName ' , '' ),
4033 );
4134 }
4235
@@ -47,12 +40,9 @@ public function toArray(): array
4740 'status ' => $ this ->status ,
4841 'url ' => $ this ->url ,
4942 'method ' => $ this ->method ,
50- 'exception ' => $ this ->exception ?->toArray(),
51- 'stack ' => $ this ->stack ,
52- 'message ' => $ this ->message ,
53- 'isLoggedToVault ' => $ this ->isLoggedToVault ,
54- 'isLoggedToApplication ' => $ this ->isLoggedToApplication ,
5543 'exceptionName ' => $ this ->exceptionName ,
44+ 'exceptionMessage ' => $ this ->exceptionMessage ,
45+ 'stack ' => $ this ->stack ,
5646 ];
5747 }
5848}
0 commit comments