1 package com.atlassian.sal.api.net;
2
3 /**
4 * Thrown by {@link Request#execute()} to indicate that the request was unsuccessful
5 * based on the response's status code.
6 * <p>
7 * For other Request methods that take a response handler, this exception is not thrown
8 * since it is up to the handler to determine whether a response was an error.
9 *
10 * @since 2.7.0
11 */
12 public class ResponseStatusException extends ResponseException
13 {
14 private final Response response;
15
16 public ResponseStatusException(String message, Response response)
17 {
18 super(message);
19 this.response = response;
20 }
21
22 /**
23 * Returns the actual response, allowing further inspection of the status code
24 * and error message.
25 */
26 public Response getResponse()
27 {
28 return response;
29 }
30 }