Package libcore.io
Class GaiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
libcore.io.GaiException
- All Implemented Interfaces:
Serializable
public final class GaiException extends RuntimeException
An unchecked exception thrown when the
Os getaddrinfo or getnameinfo
methods fail. This exception contains the native error value, for comparison against the
GAI_ constants in OsConstants, 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 interror -
Constructor Summary
Constructors Constructor Description GaiException(String functionName, int error)GaiException(String functionName, int error, Throwable cause) -
Method Summary
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 Details
-
error
public final int error
-
-
Constructor Details
-
GaiException
-
GaiException
-
-
Method Details
-
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
- Throws:
UnknownHostException
-