Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/gn/builder.cc

Issue 318383003: Improve error messages and reporting in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/builder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/builder.cc
diff --git a/tools/gn/builder.cc b/tools/gn/builder.cc
index b8ef71ee7a34b4f4098081e665e1c6994a09156f..132f4e0a604df5b6a023056cd9be3a2d4526ba13 100644
--- a/tools/gn/builder.cc
+++ b/tools/gn/builder.cc
@@ -258,15 +258,17 @@ BuilderRecord* Builder::GetOrCreateRecordOfType(const Label& label,
// Check types.
if (record->type() != type) {
- *err = Err(request_from, "Item type does not match.",
- "The item \"" + label.GetUserVisibleName(false) +
- "\"\nwas expected to be a " +
- BuilderRecord::GetNameForType(type) +
- " but was previously referenced as a " +
- BuilderRecord::GetNameForType(record->type()));
+ std::string msg =
+ "The type of " + label.GetUserVisibleName(false) +
+ "\nhere is a " + BuilderRecord::GetNameForType(type) +
+ " but was previously seen as a " +
+ BuilderRecord::GetNameForType(record->type()) + ".\n\n"
+ "The most common cause is that the label of a config was put in the\n"
+ "in the deps section of a target (or vice-versa).";
+ *err = Err(request_from, "Item type does not match.", msg);
if (record->originally_referenced_from()) {
err->AppendSubErr(Err(record->originally_referenced_from(),
- "The previous reference was here."));
+ std::string()));
}
return NULL;
}
@@ -361,7 +363,9 @@ void Builder::RecursiveSetShouldGenerate(BuilderRecord* record,
}
void Builder::ScheduleItemLoadIfNecessary(BuilderRecord* record) {
- loader_->Load(record->label());
+ const ParseNode* origin = record->originally_referenced_from();
+ loader_->Load(record->label(),
+ origin ? origin->GetRange() : LocationRange());
}
bool Builder::ResolveItem(BuilderRecord* record, Err* err) {
« no previous file with comments | « no previous file | tools/gn/builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698