From 8b498ccab3bf74c431d2e9ed9a540f6fca6b2b95 Mon Sep 17 00:00:00 2001 From: Erik Schultink Date: Fri, 4 Oct 2024 10:17:56 -0700 Subject: [PATCH] cleanup error handling case --- .../psoxy/gateway/impl/CommonRequestHandler.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/java/core/src/main/java/co/worklytics/psoxy/gateway/impl/CommonRequestHandler.java b/java/core/src/main/java/co/worklytics/psoxy/gateway/impl/CommonRequestHandler.java index 14262422d..31bd2ced1 100644 --- a/java/core/src/main/java/co/worklytics/psoxy/gateway/impl/CommonRequestHandler.java +++ b/java/core/src/main/java/co/worklytics/psoxy/gateway/impl/CommonRequestHandler.java @@ -212,11 +212,10 @@ public HttpEventResponse handle(HttpEventRequest request) { sourceApiRequest = requestFactory.buildRequest(request.getHttpMethod(), new GenericUrl(targetForSourceApiRequest), content); } catch (IOException e) { builder.statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); - builder.body("Failed to parse request; review logs"); + builder.body("Failed to parse response; review logs"); builder.header(ResponseHeader.ERROR.getHttpHeader(), ErrorCauses.CONNECTION_SETUP.name()); - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, e.getMessage()); //something like "Error getting access token for service account: 401 Unauthorized POST https://oauth2.googleapis.com/token," - log.log(Level.WARNING, "Confirm oauth scopes set in config.yaml match those granted in data source"); return builder.build(); } catch (java.util.NoSuchElementException e) { // missing config, such as ACCESS_TOKEN @@ -225,8 +224,6 @@ public HttpEventResponse handle(HttpEventRequest request) { log.log(Level.WARNING, e.getMessage(), e); return builder.build(); } - - //TODO: what headers to forward??? populateHeadersFromSource(sourceApiRequest, request, targetForSourceApiRequest); //setup request