Better located error handling

This commit is contained in:
Vladimir Razuvaev 2017-07-19 20:08:42 +07:00
parent 81986145fe
commit 87c812b221

View File

@ -79,8 +79,13 @@ class Error extends \Exception implements \JsonSerializable, ClientAware
*/
public static function createLocatedError($error, $nodes = null, $path = null)
{
if ($error instanceof self && $error->path) {
if ($error instanceof self) {
if ($error->path && $error->nodes) {
return $error;
} else {
$nodes = $nodes ?: $error->nodes;
$path = $path ?: $error->path;
}
}
$source = $positions = $originalError = null;