Skip to content

Commit acc4167

Browse files
committed
Updated Handling
1 parent 4589515 commit acc4167

File tree

4 files changed

+9
-92
lines changed

4 files changed

+9
-92
lines changed

src/DTO/Exception.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/DTO/InnerException.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/DTO/MFilesError.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Exceptions/MFilesErrorException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ final class MFilesErrorException extends BaseException
1212
public function __construct(
1313
public readonly MFilesError $error
1414
) {
15-
parent::__construct($error->message, $error->status);
15+
parent::__construct($error->exceptionMessage, $error->status);
1616
}
1717
}
18+

0 commit comments

Comments
 (0)