MCPcopy Create free account
hub / github.com/GDATASoftwareAG/vaas / throwParsedVaasError

Method throwParsedVaasError

java/src/main/java/de/gdata/vaas/Vaas.java:71–95  ·  view source on GitHub ↗
(HttpResponse<String> response)

Source from the content-addressed store, hash-verified

69 }
70
71 private static void throwParsedVaasError(HttpResponse<String> response) throws VaasAuthenticationException, VaasClientException, VaasServerException {
72 try {
73 var problemDetails = ProblemDetails.fromJson(response.body());
74 if(problemDetails == null) {
75 throw new JsonSyntaxException("no JSON in server response");
76 }
77 var type = problemDetails.type;
78 var detail = problemDetails.detail;
79 if (type.equals("VaasClientException")) {
80 throw new VaasClientException(detail);
81 } else if (type.equals("VaasAuthenticationException")) {
82 throw new VaasAuthenticationException(detail);
83 }
84 throw new VaasServerException(detail);
85 } catch(JsonSyntaxException e) {
86 if (response.statusCode() == 401) {
87 throw new VaasAuthenticationException(
88 "Server did not accept token from identity provider. Check if you are using the correct identity provider and credentials.");
89 } else if (response.statusCode() >= 400 && response.statusCode() < 500) {
90 throw new VaasClientException("HTTP Error: " + response.statusCode() + " for request " + response.uri());
91 } else {
92 throw new VaasServerException("HTTP Error: " + response.statusCode() + " for request " + response.uri());
93 }
94 }
95 }
96
97 private static String encodeParams(Map<String, String> params) {
98 StringBuilder encodedParams = new StringBuilder();

Callers 4

sendUrlWithRetryMethod · 0.95
sendFileWithRetryMethod · 0.95
forStreamAsyncMethod · 0.95
forUrlAsyncMethod · 0.95

Calls 1

fromJsonMethod · 0.95

Tested by

no test coverage detected