diff --git a/src/GraphQL/Mutation/MutationType.php b/src/GraphQL/Mutation/MutationType.php index 8aaff3bf..63934123 100644 --- a/src/GraphQL/Mutation/MutationType.php +++ b/src/GraphQL/Mutation/MutationType.php @@ -657,7 +657,19 @@ public function buildDataObjectMutations(&$config = [], $context = []) } } - $me->saveElement($newInstance, $args); + try { + $me->saveElement($newInstance, $args); + } catch (DuplicateFullPathException $e) { + return [ + 'success' => false, + 'message' => 'creating failed: Duplicate path', + ]; + } catch (\Exception $e) { + return [ + 'success' => false, + 'message' => 'creating failed: ' . $e->getMessage(), + ]; + } if ($tags) { $me->setTags('object', $newInstance->getId(), $tags);