2017-07-18 16:57:30 +03:00
|
|
|
<?php
|
2018-06-19 15:53:56 +03:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2017-07-18 16:57:30 +03:00
|
|
|
namespace GraphQL\Error;
|
|
|
|
|
|
|
|
/**
|
2017-08-19 22:33:31 +03:00
|
|
|
* This interface is used for [default error formatting](error-handling.md).
|
2017-07-18 16:57:30 +03:00
|
|
|
*
|
2017-08-19 19:01:46 +03:00
|
|
|
* Only errors implementing this interface (and returning true from `isClientSafe()`)
|
|
|
|
* will be formatted with original error message.
|
|
|
|
*
|
|
|
|
* All other errors will be formatted with generic "Internal server error".
|
2017-07-18 16:57:30 +03:00
|
|
|
*/
|
|
|
|
interface ClientAware
|
|
|
|
{
|
|
|
|
/**
|
2017-08-19 19:01:46 +03:00
|
|
|
* Returns true when exception message is safe to be displayed to a client.
|
2017-07-18 16:57:30 +03:00
|
|
|
*
|
|
|
|
* @return bool
|
2018-09-26 11:36:07 +03:00
|
|
|
*
|
|
|
|
* @api
|
2017-07-18 16:57:30 +03:00
|
|
|
*/
|
|
|
|
public function isClientSafe();
|
2017-08-07 22:00:17 +03:00
|
|
|
|
|
|
|
/**
|
2017-08-19 19:01:46 +03:00
|
|
|
* Returns string describing a category of the error.
|
2017-08-07 22:00:17 +03:00
|
|
|
*
|
|
|
|
* Value "graphql" is reserved for errors produced by query parsing or validation, do not use it.
|
|
|
|
*
|
|
|
|
* @return string
|
2018-09-26 11:36:07 +03:00
|
|
|
*
|
|
|
|
* @api
|
2017-08-07 22:00:17 +03:00
|
|
|
*/
|
|
|
|
public function getCategory();
|
2017-07-18 16:57:30 +03:00
|
|
|
}
|