blob: ef41a04f7c71ab935a3f61fa574ea9cdaf5350c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.core;
import com.google.common.annotations.Beta;
/**
* The request was not processed properly on the server.
*
* @author Einar M R Rosenvinge
*/
@SuppressWarnings("serial")
@Beta
public class ServerResponseException extends Exception {
private final int responseCode;
private final String responseString;
public ServerResponseException(int responseCode, String responseString) {
super(responseString);
this.responseCode = responseCode;
this.responseString = responseString;
}
public ServerResponseException(String responseString) {
super(responseString);
this.responseCode = 0;
this.responseString = responseString;
}
public int getResponseCode() {
return responseCode;
}
public String getResponseString() {
return responseString;
}
@Override
public String toString() {
if (responseCode > 0) {
return responseCode + ": " + responseString;
}
return responseString;
}
}
|