Automattic\WooCommerce\Vendor\GraphQL\Error

FormattedError::prepareFormatterpublic staticWC 1.0

Prepares final error formatter taking in account $debug flags.

If initial formatter is not set, FormattedError::createFromException is used.

Method of the class: FormattedError{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = FormattedError::prepareFormatter( ?callable $formatter, $debug ): callable;
?callable $formatter(required)
.
$debug(int) (required)
.

FormattedError::prepareFormatter() code WC 10.9.1

public static function prepareFormatter(?callable $formatter, int $debug): callable
{
    return $formatter === null
        ? static fn (\Throwable $e): array => static::createFromException($e, $debug)
        : static fn (\Throwable $e): array => static::addDebugEntries($formatter($e), $e, $debug);
}