Skip to content

Commit

Permalink
refactor into a single method
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Sankeerth committed Sep 21, 2022
1 parent 32e736c commit a5b4211
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions v0/destinations/marketo/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,11 @@ const responseHandler = (destinationResponse, _dest) => {
.build();
}
// check for marketo application level failures
marketoApplicationErrorHandler(
marketoResponseHandler(
destinationResponse,
"during Marketo Response Handling",
TRANSFORMER_METRIC.TRANSFORMER_STAGE.RESPONSE_TRANSFORM
);
const { response } = destinationResponse;
if (response && !response.success) {
// non 2xx failure
throw new ErrorBuilder()
.setStatus(400)
.setMessage(`Error occured during Marketo Response Handling`)
.setDestinationResponse(destinationResponse.response)
.setStatTags({
destType: DESTINATION,
stage: TRANSFORMER_METRIC.TRANSFORMER_STAGE.RESPONSE_TRANSFORM,
scope: TRANSFORMER_METRIC.MEASUREMENT_TYPE.EXCEPTION.SCOPE
})
.build();
}
// else successfully return status, message and original destination response
return {
status,
Expand Down

0 comments on commit a5b4211

Please sign in to comment.