Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Move error handling after resolving promise (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
crisu83 committed Nov 9, 2018
1 parent b1f5c00 commit 96b9518
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Execution/Execution.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ public function execute(

$data = $this->executeOperation($operationName, $context, $fieldCollector, $valuesResolver);

if (null !== $errorHandler) {
foreach ($context->getErrors() as $error) {
$errorHandler->handleError($error);
}
}

if ($data instanceof PromiseInterface) {
$data->then(function ($resolvedData) use (&$data) {
$data = $resolvedData;
});
}

if (null !== $errorHandler) {
foreach ($context->getErrors() as $error) {
$errorHandler->handleError($error);
}
}

return new ExecutionResult($data, $context->getErrors());
}

Expand Down

0 comments on commit 96b9518

Please sign in to comment.