Skip to content

Commit

Permalink
Fix processing, improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Nov 27, 2023
1 parent a0052b5 commit 165eb58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/e2e/src/pusher/pusher.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
"postProcessingSpecificationV2": {
"environment": "Node",
"value": "({ endpointParameters, response }) => { return { response: response[endpointParameters.name].value }; }",
"value": "({ endpointParameters, response }) => { return { response: response[endpointParameters.name] }; }",
"timeoutMs": 5000
}
}
Expand Down
14 changes: 9 additions & 5 deletions packages/pusher/src/api-requests/data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,25 @@ export const makeTemplateRequests = async (signedApiUpdate: SignedApiUpdate): Pr
return null;
}

const { _type, _path, _times } = getReservedParameters(
oisEndpoint as Parameters<typeof getReservedParameters>[0], // TS doesn't realize the types are the same because of https://github.com/microsoft/TypeScript/issues/26627#issuecomment-416046113.
endpointParameters
);
const goEncodedResponse = goSync(() => {
const { _type, _path, _times } = getReservedParameters(
oisEndpoint as Parameters<typeof getReservedParameters>[0], // TS doesn't realize the types are the same because of https://github.com/microsoft/TypeScript/issues/26627#issuecomment-416046113.
endpointParameters
);
return extractAndEncodeResponse(goPostProcess.data.response, {
_type,
_path,
_times,
});
});
if (!goEncodedResponse.success) {
logger.warn(`Failed to encode response`, {
logger.error(`Failed to encode response`, {
templateId,
operationTemplateId,
response: goPostProcess.data.response,
_type,
_path,
_times,
errorMessage: goEncodedResponse.error.message,
});
return null;
Expand Down

0 comments on commit 165eb58

Please sign in to comment.