net.zortrium.p2proto
Class PeerErrorException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by net.zortrium.p2proto.PeerException
                  extended by net.zortrium.p2proto.PeerErrorException
All Implemented Interfaces:
Serializable

public class PeerErrorException
extends PeerException

Exception indicating that a peer encountered an error while processing a request message. This does not mean that the peer encountered an exception itself -- it simply responded with a message indicating some sort of error. Note that this is very distinct from a PeerTimeoutException, which indicates that no response at all was received (error or otherwise).

Author:
Sean Barker - www.zortrium.net
See Also:
Serialized Form

Method Summary
 Msg getErrorMessage()
          Get the content message sent with the error.
 String getErrorString()
          Get the textual error message sent from the remote host.
 boolean hasErrorMessage()
          Check whether the error was sent with a content message (in addition to the simple error string).
 String toString()
           
 
Methods inherited from class net.zortrium.p2proto.PeerException
getPeer, getRequest
 
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
 

Method Detail

getErrorString

public String getErrorString()
Get the textual error message sent from the remote host. This is a simple string indicating the type of error that occurred, and is always available. If the sender included a regular message as well, it may be accessed via getErrorMessage().

Returns:
The textual error message.

hasErrorMessage

public boolean hasErrorMessage()
Check whether the error was sent with a content message (in addition to the simple error string).

Returns:
True if a content message is available.

getErrorMessage

public Msg getErrorMessage()
Get the content message sent with the error. This is a regular message containing a type and (optionally) binary content. If no content message was provided by the sender, this method returns null.

Returns:
The error message or null.

toString

public String toString()
Overrides:
toString in class PeerException