Package org.kohsuke.github
Class HttpException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.kohsuke.github.GHIOException
-
- org.kohsuke.github.HttpException
-
- All Implemented Interfaces:
Serializable
public class HttpException extends GHIOException
IOException
for http exceptions becauseHttpURLConnection
throws un-discernedIOException
and it can help to know the http response code to decide how to handle an http exceptions.- Author:
- Cyrille Le Clerc
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.kohsuke.github.GHIOException
responseHeaderFields
-
-
Constructor Summary
Constructors Constructor Description HttpException(int responseCode, String responseMessage, String url, Throwable cause)
Instantiates a new Http exception.HttpException(int responseCode, String responseMessage, URL url, Throwable cause)
Instantiates a new Http exception.HttpException(String message, int responseCode, String responseMessage, String url)
Instantiates a new Http exception.HttpException(String message, int responseCode, String responseMessage, String url, Throwable cause)
Instantiates a new Http exception.HttpException(GitHubConnectorResponse connectorResponse)
Instantiates a new Http exception.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getResponseCode()
Http response code of the request that cause the exception.String
getResponseMessage()
Http response message of the request that cause the exception.String
getUrl()
The http URL that caused the exception.-
Methods inherited from class org.kohsuke.github.GHIOException
getResponseHeaderFields
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
HttpException
public HttpException(String message, int responseCode, String responseMessage, String url)
Instantiates a new Http exception.- Parameters:
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method)responseCode
- Http response code.-1
if no code can be discerned.responseMessage
- Http response messageurl
- The url that was invoked- See Also:
HttpURLConnection#getResponseCode()
,HttpURLConnection#getResponseMessage()
-
HttpException
public HttpException(String message, int responseCode, String responseMessage, String url, Throwable cause)
Instantiates a new Http exception.- Parameters:
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method)responseCode
- Http response code.-1
if no code can be discerned.responseMessage
- Http response messageurl
- The url that was invokedcause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)- See Also:
HttpURLConnection#getResponseCode()
,HttpURLConnection#getResponseMessage()
-
HttpException
public HttpException(int responseCode, String responseMessage, String url, Throwable cause)
Instantiates a new Http exception.- Parameters:
responseCode
- Http response code.-1
if no code can be discerned.responseMessage
- Http response messageurl
- The url that was invokedcause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)- See Also:
HttpURLConnection#getResponseCode()
,HttpURLConnection#getResponseMessage()
-
HttpException
public HttpException(int responseCode, String responseMessage, @CheckForNull URL url, Throwable cause)
Instantiates a new Http exception.- Parameters:
responseCode
- Http response code.-1
if no code can be discerned.responseMessage
- Http response messageurl
- The url that was invokedcause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)- See Also:
HttpURLConnection#getResponseCode()
,HttpURLConnection#getResponseMessage()
-
HttpException
public HttpException(GitHubConnectorResponse connectorResponse)
Instantiates a new Http exception.- Parameters:
connectorResponse
- the connector response to base this on
-
-
Method Detail
-
getResponseCode
public int getResponseCode()
Http response code of the request that cause the exception.- Returns:
-1
if no code can be discerned.
-
getResponseMessage
public String getResponseMessage()
Http response message of the request that cause the exception.- Returns:
null
if no response message can be discerned.
-
getUrl
public String getUrl()
The http URL that caused the exception.- Returns:
- url url
-
-