clean up file path messages for better troubleshooting

This commit is contained in:
Grahame Grieve 2023-08-22 21:47:25 +10:00
parent 54eb35fa1a
commit b0a9bf27ed
2 changed files with 4 additions and 4 deletions

View File

@ -150,7 +150,7 @@ public class PathBuilder {
return;
}
if (isPathRoot(args[0])) {
throw new RuntimeException("First entry cannot be root: " + args[0]);
throw new RuntimeException("First entry in file path cannot be root: " + args[0]+", full path = "+String.join(", ", args));
}
}
@ -159,7 +159,7 @@ public class PathBuilder {
return;
}
if (args[0] == null || Utilities.noString(args[0].trim())) {
throw new RuntimeException("First path entry cannot be null or empty");
throw new RuntimeException("First entry in file path cannot be null or empty, full path = "+String.join(", ", args));
}
}

View File

@ -293,7 +293,7 @@ class UtilitiesTest {
RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, () -> {
Utilities.path(pathStrings);
});
assertTrue(thrown.getMessage().endsWith(pathStrings[0]));
assertTrue(thrown.getMessage().endsWith(pathStrings[0]+", full path = "+String.join(", ", pathStrings)));
}
public static Stream<Arguments> macAndLinuxNonFirstElementStartPaths() {
@ -384,7 +384,7 @@ class UtilitiesTest {
RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, () -> {
Utilities.path(pathsStrings);
});
assertEquals("First path entry cannot be null or empty",thrown.getMessage());
assertEquals("First entry in file path cannot be null or empty, full path = "+String.join(", ", pathsStrings),thrown.getMessage());
}
@Test