org.networkupstools.jnut
Class NutException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.networkupstools.jnut.NutException
All Implemented Interfaces:
java.io.Serializable

public class NutException
extends java.lang.Exception

Class representing a NUT exception.

Instance are thrown when an UPSD returns an error with an "ERR" directive. Moreover it can ben thrown with some extra errors like:

A Nut exception has a (standard java exception message) message which correspond to error code returns by UPSD (like 'ACCESS-DENIED', 'UNKNOWN-UPS' ...). An extra string embed a more descriptive english message.

Author:
Emilien Kia
See Also:
Serialized Form

Field Summary
static java.lang.String DriverNotConnected
           
 java.lang.String extra
           
static java.lang.String UnknownResponse
           
 
Constructor Summary
NutException()
           
NutException(java.lang.String message)
           
NutException(java.lang.String message, java.lang.String extra)
           
NutException(java.lang.String message, java.lang.String extra, java.lang.Throwable cause)
           
NutException(java.lang.String message, java.lang.Throwable cause)
           
NutException(java.lang.Throwable cause)
           
 
Method Summary
 java.lang.String getExtra()
          Returns the extra message.
 boolean is(java.lang.String name)
          Test is the exception corresponds to the specified name.
 void setExtra(java.lang.String extra)
          Set the extra message.
 java.lang.String toString()
          Format an exception message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UnknownResponse

public static java.lang.String UnknownResponse

DriverNotConnected

public static java.lang.String DriverNotConnected

extra

public java.lang.String extra
Constructor Detail

NutException

public NutException()

NutException

public NutException(java.lang.String message)

NutException

public NutException(java.lang.String message,
                    java.lang.String extra)

NutException

public NutException(java.lang.Throwable cause)

NutException

public NutException(java.lang.String message,
                    java.lang.Throwable cause)

NutException

public NutException(java.lang.String message,
                    java.lang.String extra,
                    java.lang.Throwable cause)
Method Detail

getExtra

public java.lang.String getExtra()
Returns the extra message.

Returns:
Extra message if any.

setExtra

public void setExtra(java.lang.String extra)
Set the extra message.

Parameters:
extra - The new extra message.

is

public boolean is(java.lang.String name)
Test is the exception corresponds to the specified name.

Parameters:
name - Name to test
Returns:
True if exception corresponds.

toString

public java.lang.String toString()
Format an exception message.

Overrides:
toString in class java.lang.Throwable
Returns:
Exception message


Copyright © 2011. All Rights Reserved.