-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #19646 Log error nicely * remove import * Rename AddFileNotPossibleException to FileCreationException
- Loading branch information
1 parent
991255a
commit 7853e4b
Showing
3 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
dotCMS/src/main/java/com/dotcms/publishing/output/FileCreationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.dotcms.publishing.output; | ||
|
||
|
||
import java.io.IOException; | ||
|
||
public class FileCreationException extends IOException { | ||
|
||
private String filePath; | ||
|
||
public FileCreationException(final Throwable cause, final String filePath) { | ||
super(cause); | ||
this.filePath = filePath; | ||
} | ||
|
||
@Override | ||
public String getMessage(){ | ||
final Throwable cause = this.getCause(); | ||
|
||
final String message = cause.getMessage().contains("Not a directory") ? | ||
"At least one subfolder already exists as a file" : cause.getMessage(); | ||
|
||
return String.format("It is not possible create the File: %s because: %s", filePath, | ||
message); | ||
} | ||
} |