1 package de.larssh.jes;
2
3 import org.apache.commons.net.ftp.FTPClient;
4
5 import de.larssh.utils.text.Strings;
6
7 /**
8 * Thrown to indicate that a logical JES exception occurred.
9 */
10 public class JesException extends Exception {
11 /**
12 * Constructs a new {@link JesException} with the given message, formatting as
13 * described at {@link Strings#format(String, Object...)}.
14 *
15 * @param message the detail message
16 * @param arguments arguments referenced by format specifiers in {@code message}
17 */
18 public JesException(final String message, final Object... arguments) {
19 super(Strings.format(message, arguments), null);
20 }
21
22 /**
23 * Constructs a new {@link JesException} with the given message, formatting as
24 * described at {@link Strings#format(String, Object...)}, appending the latest
25 * FTP reply string.
26 *
27 * @param ftpClient FTP client with reply string
28 * @param message the detail message
29 * @param arguments arguments referenced by format specifiers in {@code message}
30 */
31 public JesException(final FTPClient ftpClient, final String message, final Object... arguments) {
32 this("%s Reason: %s", Strings.format(message, arguments), ftpClient.getReplyString());
33 }
34 }