Automattic\WooCommerce\Api\Infrastructure
GraphQLControllerBase::get_resolve_error_status
Determine the HTTP status code for an error returned by QueryCache::resolve().
PERSISTED_QUERY_NOT_FOUND uses 200 per the Apollo APQ convention (protocol signal, not error).
Method of the class: GraphQLControllerBase{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->get_resolve_error_status( $response ): int;
- $response(array) (required)
- The error response array from resolve().
GraphQLControllerBase::get_resolve_error_status() GraphQLControllerBase::get resolve error status code WC 10.9.1
private function get_resolve_error_status( array $response ): int {
$code = $response['errors'][0]['extensions']['code'] ?? '';
if ( 'PERSISTED_QUERY_NOT_FOUND' === $code ) {
return 200;
}
return 400;
}