1 package com.atlassian.httpclient.api;
2
3
4
5
6
7 public class UnexpectedResponseException extends RuntimeException {
8 private Response response;
9
10
11
12
13
14
15 public UnexpectedResponseException(Response response) {
16 this.response = response;
17 }
18
19
20
21
22
23
24 public Response getResponse() {
25 return response;
26 }
27
28 @Override
29 public String toString() {
30 StringBuilder sb = new StringBuilder();
31 sb.append("Unexpected response '").append(response.getStatusCode()).append("' with message '");
32 sb.append(response.getStatusText()).append("'");
33 return sb.toString();
34 }
35 }