Skip to content

Commit 87c812b

Browse files
committed
Better located error handling
1 parent 8198614 commit 87c812b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Error/Error.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,13 @@ class Error extends \Exception implements \JsonSerializable, ClientAware
7979
*/
8080
public static function createLocatedError($error, $nodes = null, $path = null)
8181
{
82-
if ($error instanceof self && $error->path) {
83-
return $error;
82+
if ($error instanceof self) {
83+
if ($error->path && $error->nodes) {
84+
return $error;
85+
} else {
86+
$nodes = $nodes ?: $error->nodes;
87+
$path = $path ?: $error->path;
88+
}
8489
}
8590

8691
$source = $positions = $originalError = null;

0 commit comments

Comments
 (0)