From 87c812b221ce26499c5f70559230ba60c3bb3418 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Wed, 19 Jul 2017 20:08:42 +0700 Subject: [PATCH] Better located error handling --- src/Error/Error.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Error/Error.php b/src/Error/Error.php index 8376141..3677298 100644 --- a/src/Error/Error.php +++ b/src/Error/Error.php @@ -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) { - return $error; + if ($error instanceof self) { + if ($error->path && $error->nodes) { + return $error; + } else { + $nodes = $nodes ?: $error->nodes; + $path = $path ?: $error->path; + } } $source = $positions = $originalError = null;