Extend error message when calling bazel outside a workspace
Bazel errors out when it is called outside a workspace. This is
a necessary behavior, but the error message was considereed
unhelpful; so extend it to include a link to the documentation.
Closes #7162.
Change-Id: Icbf541cf6b5394922575f3a67a6ddf60471f0e9c
PiperOrigin-RevId: 234469741
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java
index 9287d53..31b3ebc 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java
@@ -110,7 +110,10 @@
Event.error(
"The '"
+ commandAnnotation.name()
- + "' command is only supported from within a workspace."));
+ + "' command is only supported from within a workspace"
+ + " (below a directory having a WORKSPACE file).\n"
+ + "See documentation at"
+ + " https://docs.bazel.build/versions/master/build-ref.html#workspace"));
return ExitCode.COMMAND_LINE_ERROR;
}