use of com.okta.sdk.impl.error.DefaultError in project okta-sdk-java by okta.
the class DefaultDataStore method execute.
private Response execute(Request request) throws ResourceException {
applyDefaultRequestHeaders(request);
Response response = this.requestExecutor.executeRequest(request);
log.trace("Executed HTTP request.");
if (requestLog.isTraceEnabled()) {
requestLog.trace("Executing request: method: '{}', url: {}", request.getMethod(), request.getResourceUrl());
}
if (response.isError()) {
Map<String, Object> body = getBody(response);
String requestId = response.getHeaders().getOktaRequestId();
if (Strings.hasText(requestId)) {
body.put(DefaultError.ERROR_ID.getName(), requestId);
}
throw new ResourceException(new DefaultError(body).setHeaders(response.getHeaders().getXHeaders()).setStatus(response.getHttpStatus()));
}
return response;
}
Aggregations