Skip to content

Commit f170836

Browse files
committed
Construct field_path in a separate variable for clarity
1 parent 19101d0 commit f170836

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/GraphQLService.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,11 @@ AwaitableResolver Object::resolve(const SelectionSetParams& selectionSetParams,
12451245

12461246
message << "Ambiguous field error name: " << child.name;
12471247

1248+
field_path path { parent, path_segment { child.name } };
1249+
12481250
document.errors.push_back({ message.str(),
12491251
child.location.value_or(schema_location {}),
1250-
buildErrorPath(
1251-
std::make_optional(field_path { parent, path_segment { child.name } })) });
1252+
buildErrorPath(std::make_optional(path)) });
12521253
}
12531254

12541255
if (!value.errors.empty())
@@ -1273,10 +1274,11 @@ AwaitableResolver Object::resolve(const SelectionSetParams& selectionSetParams,
12731274

12741275
message << "Field error name: " << child.name << " unknown error: " << ex.what();
12751276

1277+
field_path path { parent, path_segment { child.name } };
1278+
12761279
document.errors.push_back({ message.str(),
12771280
child.location.value_or(schema_location {}),
1278-
buildErrorPath(
1279-
std::make_optional(field_path { parent, path_segment { child.name } })) });
1281+
buildErrorPath(std::make_optional(path)) });
12801282
document.data.emplace_back(std::string { child.name }, {});
12811283
}
12821284
}

0 commit comments

Comments
 (0)