-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFormattedError.php
More file actions
26 lines (20 loc) · 747 Bytes
/
FormattedError.php
File metadata and controls
26 lines (20 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
declare(strict_types=1);
namespace SimPod\GraphQLUtils\Error;
use GraphQL\Error\DebugFlag;
use Throwable;
/** @deprecated Use {@see ProvidesExtensions} */
class FormattedError extends \GraphQL\Error\FormattedError
{
public static function createFromException(
Throwable $exception,
int $debugFlag = DebugFlag::NONE,
string|null $internalErrorMessage = null,
): array {
$arrayError = parent::createFromException($exception, $debugFlag, $internalErrorMessage);
if ($exception instanceof \GraphQL\Error\Error && $exception->getPrevious() instanceof Error) {
$arrayError['extensions']['type'] = $exception->getPrevious()->getType();
}
return $arrayError;
}
}