Package org.eclipse.sw360.http.utils
Class FailedRequestException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.eclipse.sw360.http.utils.FailedRequestException
-
- All Implemented Interfaces:
Serializable
public class FailedRequestException extends IOException
A special exception class to report errors caused by requests that have an unexpected (typically non-success) status code.
This exception class stores the response status code, so that it is available for further investigation. A cause is not available because the request completed normally. In order to identify the request that failed, a tag can be provided that is added to the exception message. This is useful if a future is constructed from the results of multiple requests.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FailedRequestException(String tag, int statusCode)Creates a new instance ofFailedRequestExceptionand initializes it with a tag and the status code that caused the exception.FailedRequestException(String tag, int statusCode, String serverMessage)Creates a new instance ofFailedRequestExceptionand initializes it with a tag, the error status code, and the message sent from the server as response to the failed request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetStatusCode()Returns the response status code that caused this exception.StringgetTag()Returns a tag to identify the failed request.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
FailedRequestException
public FailedRequestException(String tag, int statusCode)
Creates a new instance ofFailedRequestExceptionand initializes it with a tag and the status code that caused the exception.- Parameters:
tag- a tag to identify the failed requeststatusCode- the HTTP status code
-
FailedRequestException
public FailedRequestException(String tag, int statusCode, String serverMessage)
Creates a new instance ofFailedRequestExceptionand initializes it with a tag, the error status code, and the message sent from the server as response to the failed request.- Parameters:
tag- a tag to identify the failed requeststatusCode- the HTTP status codeserverMessage- the error message sent by the server
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Returns the response status code that caused this exception.- Returns:
- the HTTP status code of the failed response
-
getTag
public String getTag()
Returns a tag to identify the failed request. Result can be null if no tag has been provided.- Returns:
- a tag for the failed request
-
-