From bbbe1f14e0c2644f62c628406c0a26fc9bb67554 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Thu, 14 Mar 2019 13:21:34 +0000 Subject: loader: clearer error if no junction project.conf I found the original message confusing - it would talk about wanting a project at '.', without a frame of reference. After re-reading the code and junction docs it made more sense, I think this version would save folks the trouble. Removing all mention of it, if it's not specified. If it is specified then explain it a bit more, i.e. Before: Could not find the project.conf file for junction element at hello-junction.bst [line 1 column 0]. Expecting a project at path 'project' After: Could not find the project.conf file in project referred to by junction element 'hello-junction.bst'. Was expecting it at path 'project' in the junction's source. If no 'path' specified in the junction: Could not find the project.conf file in project referred to by junction element 'hello-junction.bst'. --- buildstream/_loader/loader.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'buildstream') diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py index 9b91e91fe..f7fd3203e 100644 --- a/buildstream/_loader/loader.py +++ b/buildstream/_loader/loader.py @@ -570,10 +570,14 @@ class Loader(): parent_loader=self) except LoadError as e: if e.reason == LoadErrorReason.MISSING_PROJECT_CONF: + message = ( + "Could not find the project.conf file in the project " + "referred to by junction element '{}'.".format(element.name) + ) + if element.path: + message += " Was expecting it at path '{}' in the junction's source.".format(element.path) raise LoadError(reason=LoadErrorReason.INVALID_JUNCTION, - message="Could not find the project.conf file for {}. " - "Expecting a project at path '{}'" - .format(element, element.path or '.')) from e + message=message) from e else: raise -- cgit v1.2.1