commit | d4f51b95091709d2ca291e0003ba0317979d393b | [log] [tgz] |
---|---|---|
author | nharmata <nharmata@google.com> | Thu Mar 28 08:36:24 2019 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Mar 28 08:37:52 2019 -0700 |
tree | 7e8982c94c875a9a24ef7a3b49a4f3962af1b98d | |
parent | 18ef7a5cc3dc0b558266be613f24ff8d51a4bb35 [diff] |
Improve usefulness of NotASymlinkException#getMessage. Note that the returned string can make its way into Bazel's printed error message. RELNOTES: None PiperOrigin-RevId: 240779338
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java index 97e1933..abaa6b1 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
@@ -57,7 +57,7 @@ */ protected static final class NotASymlinkException extends IOException { public NotASymlinkException(Path path) { - super(path.toString()); + super(path + " is not a symlink"); } }
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java index a7bce7b..c1726ba 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
@@ -354,7 +354,7 @@ xFile.readSymbolicLink(); // not a link fail(); } catch (NotASymlinkException e) { - assertThat(e).hasMessageThat().isEqualTo(xFile.toString()); + assertThat(e).hasMessageThat().isEqualTo(xFile.toString() + " is not a symlink"); } try {