Package android.system
Class GaiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- android.system.GaiException
-
- All Implemented Interfaces:
Serializable
public final class GaiException extends RuntimeException
An unchecked exception thrown whengetaddrinfoorgetnameinfofails. This exception contains the nativeerrorvalue, should sophisticated callers need to adjust their behavior based on the exact failure.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description interrorThe native error value, for comparison with theGAI_constants inOsConstants.
-
Constructor Summary
Constructors Constructor Description GaiException(String functionName, int error)Constructs an instance with the given function name and error value.GaiException(String functionName, int error, Throwable cause)Constructs an instance with the given function name, error value, and cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMessage()Converts the stashed function name and error value to a human-readable string.UnknownHostExceptionrethrowAsUnknownHostException()UnknownHostExceptionrethrowAsUnknownHostException(String detailMessage)-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
error
public final int error
The native error value, for comparison with theGAI_constants inOsConstants.
-
-
Constructor Detail
-
GaiException
public GaiException(String functionName, int error)
Constructs an instance with the given function name and error value.
-
-
Method Detail
-
getMessage
public String getMessage()
Converts the stashed function name and error value to a human-readable string. We do this here rather than in the constructor so that callers only pay for this if they need it.- Overrides:
getMessagein classThrowable
-
rethrowAsUnknownHostException
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException
- Throws:
UnknownHostException
-
rethrowAsUnknownHostException
public UnknownHostException rethrowAsUnknownHostException() throws UnknownHostException
- Throws:
UnknownHostException
-
-