@@ -1053,11 +1053,10 @@ void SelectionVisitor::visitField(const peg::ast_node& field)
10531053 selection,
10541054 _fragments,
10551055 _variables));
1056+ auto location = std::make_optional<schema_location>(position.line , position.column );
1057+ auto path = std::make_optional<error_path>(buildErrorPath (selectionSetParams.errorPath ));
10561058
1057- _values.push_back ({ alias,
1058- std::make_optional<schema_location>({ position.line , position.column }),
1059- std::make_optional (buildErrorPath (selectionSetParams.errorPath )),
1060- std::move (result) });
1059+ _values.push_back ({ alias, std::move (location), std::move (path), std::move (result) });
10611060 }
10621061 catch (schema_exception& scx)
10631062 {
@@ -1232,6 +1231,9 @@ AwaitableResolver Object::resolve(const SelectionSetParams& selectionSetParams,
12321231
12331232 for (auto & child : children)
12341233 {
1234+ auto location = std::move (child.location ).value_or (schema_location {});
1235+ auto path = std::move (child.path ).value_or (error_path {});
1236+
12351237 try
12361238 {
12371239 co_await launch;
@@ -1244,10 +1246,6 @@ AwaitableResolver Object::resolve(const SelectionSetParams& selectionSetParams,
12441246
12451247 message << " Ambiguous field error name: " << child.name ;
12461248
1247- auto location = (child.location ? schema_location { std::move (*child.location ) }
1248- : schema_location {});
1249- auto path = (child.path ? error_path { std::move (*child.path ) } : error_path {});
1250-
12511249 document.errors .push_back ({ message.str (), std::move (location), std::move (path) });
12521250 }
12531251
@@ -1273,10 +1271,6 @@ AwaitableResolver Object::resolve(const SelectionSetParams& selectionSetParams,
12731271
12741272 message << " Field error name: " << child.name << " unknown error: " << ex.what ();
12751273
1276- auto location = (child.location ? schema_location { std::move (*child.location ) }
1277- : schema_location {});
1278- auto path = (child.path ? error_path { std::move (*child.path ) } : error_path {});
1279-
12801274 document.errors .push_back ({ message.str (), std::move (location), std::move (path) });
12811275 document.data .emplace_back (std::string { child.name }, {});
12821276 }
0 commit comments