Skip to content

Commit a93f3a4

Browse files
committed
give the file path in the exception so that it's easier to debug
1 parent e1232e0 commit a93f3a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/ning/http/multipart/FilePartSource.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ public FilePartSource(File file) throws FileNotFoundException {
5050
this.file = file;
5151
if (file != null) {
5252
if (!file.isFile()) {
53-
throw new FileNotFoundException("File is not a normal file.");
53+
final String errorMessage =
54+
String.format("File is not a normal file (%s).", file.getAbsolutePath());
55+
throw new FileNotFoundException(errorMessage);
5456
}
5557
if (!file.canRead()) {
56-
throw new FileNotFoundException("File is not readable.");
58+
final String errorMessage =
59+
String.format("File is not readable (%s).", file.getAbsolutePath());
60+
throw new FileNotFoundException(errorMessage);
5761
}
5862
this.fileName = file.getName();
5963
}

0 commit comments

Comments
 (0)