Skip to content

Package: ClientActionResponseException

ClientActionResponseException

nameinstructionbranchcomplexitylinemethod
ClientActionResponseException(String, String, String)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
ClientActionResponseException(Throwable, String, String, String)
M: 24 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getAction()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getReason()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getResponseCode()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.elasticsearch.client.exception;
14:
15: import org.eclipse.kapua.service.elasticsearch.client.ElasticsearchClient;
16: import org.eclipse.kapua.service.elasticsearch.client.model.Request;
17:
18: /**
19: * {@link ClientException} to {@code throw} when a {@link Request} fails.
20: *
21: * @since 1.3.0
22: */
23: public class ClientActionResponseException extends ClientException {
24:
25: private final String action;
26: private final String reason;
27: private final String responseCode;
28:
29: /**
30: * Constructor.
31: *
32: * @param action The action that generated the {@link ClientActionResponseException}.
33: * @param reason The reason of the {@link ClientActionResponseException}.
34: * @param responseCode The non-2xx response code returned from the {@link ElasticsearchClient}
35: * @since 1.3.0
36: */
37: public ClientActionResponseException(String action, String reason, String responseCode) {
38: super(ClientErrorCodes.ACTION_RESPONSE_ERROR, null, action, reason, responseCode);
39:
40: this.reason = reason;
41: this.action = action;
42: this.responseCode = responseCode;
43: }
44:
45: /**
46: * Constructor.
47: *
48: * @param cause The root {@link Throwable} of this {@link ClientActionResponseException}.
49: * @param action The action that generated the {@link ClientActionResponseException}.
50: * @param reason The reason of the {@link ClientActionResponseException}.
51: * @since 1.3.0
52: */
53: public ClientActionResponseException(Throwable cause, String action, String reason, String responseCode) {
54: super(ClientErrorCodes.ACTION_RESPONSE_ERROR, cause, action, reason);
55:
56: this.reason = reason;
57: this.action = action;
58: this.responseCode = responseCode;
59: }
60:
61: /**
62: * Gets the action that generated the {@link ClientActionResponseException}.
63: *
64: * @return The action that generated the {@link ClientActionResponseException}.
65: * @since 1.3.0
66: */
67: public String getAction() {
68: return action;
69: }
70:
71: /**
72: * Gets the reason of the {@link ClientActionResponseException}.
73: *
74: * @return The reason of the {@link ClientActionResponseException}.
75: * @since 1.3.0
76: */
77: public String getReason() {
78: return reason;
79: }
80:
81: /**
82: * Gets the HTTP response code.
83: *
84: * @return The HTTP response code.
85: * @since 1.3.0
86: */
87: public String getResponseCode() {
88: return responseCode;
89: }
90: }