Class NutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.networkupstools.jnut.NutException
- All Implemented Interfaces:
Serializable
Class representing a NUT exception.
Instances of this class are thrown when an UPSD returns an error with an "ERR" directive. Moreover, it can be thrown with some extra errors like:
- UNKNOWN-RESPONSE: The response is not understood
- SERVER-NOT-CONNECTED: The
Clientis not connected to the data server yet
A NutException has a standard Java exception message which corresponds to error code returned by UPSD (like 'ACCESS-DENIED', 'UNKNOWN-UPS' ...) or defined in the class (like 'UNKNOWN-RESPONSE', 'SERVER-NOT-CONNECTED'). An extra string can be used to embed a more descriptive English message.
The is(String) method can be used to test if the exception
corresponds to a specific well-known error code.
- Author:
- Emilien Kia
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic StringNot a NUT message, but internal report whenClient.isConnected()returnsfalseduring a query (preparing to `get`, etc.)static String -
Constructor Summary
ConstructorsConstructorDescriptionNutException(String message) NutException(String message, String extra) NutException(String message, String extra, Throwable cause) NutException(String message, Throwable cause) NutException(Throwable cause) -
Method Summary
Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
UnknownResponse
-
DriverNotConnected
-
ServerNotConnected
Not a NUT message, but internal report whenClient.isConnected()returnsfalseduring a query (preparing to `get`, etc.) -
extra
-
-
Constructor Details
-
NutException
public NutException() -
NutException
-
NutException
-
NutException
-
NutException
-
NutException
-
-
Method Details
-
getExtra
-
setExtra
Set the extra message.- Parameters:
extra- The new extra message.
-
is
Test is the exception corresponds to the specified well-known problem name.- Parameters:
name- Name to test- Returns:
- True if the exception corresponds.
-
toString
-