Created
February 19, 2016 16:40
-
-
Save SnuktheGreat/21f17aa0d61aabc6af7e to your computer and use it in GitHub Desktop.
Exception type that allows developers to use log4j style message formats and arguments for both the message and exception cause.
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
import org.slf4j.helpers.FormattingTuple; | |
import org.slf4j.helpers.MessageFormatter; | |
/** | |
* Base {@link Exception} class that allows developers to use the log4j message style formats to create exception messages | |
* and pass along exception causes. | |
*/ | |
public class FormattedException extends Exception { | |
public FormattedException(String format, Object... arguments) { | |
this(MessageFormatter.arrayFormat(format, arguments)); | |
} | |
private FormattedException(FormattingTuple tuple) { | |
super(tuple.getMessage(), tuple.getThrowable()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment