public abstract class TranslatableException extends Exception
Modifier and Type | Field and Description |
---|---|
protected int |
code |
Constructor and Description |
---|
TranslatableException(int code,
String message)
Create a new exception instance
|
Modifier and Type | Method and Description |
---|---|
int |
getCode()
Retrieve the error code associated with this exception
|
String |
getLocalizedMessage()
Return the message to show to the user.
|
String |
toString()
Cause the message passed to the constructor to show up on stack trace logs
|
addSuppressed, fillInStackTrace, getCause, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public TranslatableException(int code, String message)
code
- an integer code that represents this exception statemessage
- the message that will be posted to stack traces on the console (not necessarily intended for the user)public int getCode()
public String getLocalizedMessage()
Return the message to show to the user. The framework will first look in the localized property bundles for any messages that match the supplied error code and exception type. If not found, the regular message submitted to the constructor will be returned.
Message bundle properties have the following format:
[simple class name of exception]_[integer error code]=[localized message for this exception and code]
getLocalizedMessage
in class Throwable
Copyright © 2014. All rights reserved.