Skip to content

Commit

Permalink
chore: algolia compoennt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishmalik committed Mar 15, 2024
1 parent 25c346c commit 62ccafe
Show file tree
Hide file tree
Showing 6 changed files with 967 additions and 403 deletions.
22 changes: 18 additions & 4 deletions src/v1/destinations/algolia/networkHandler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-restricted-syntax */
const { TransformerProxyError } = require('../../../v0/util/errorTypes');
const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network');
const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../../v0/util/index');
const { isHttpStatusSuccess } = require('../../../v0/util/index');

const {
processAxiosResponse,
Expand Down Expand Up @@ -44,15 +44,29 @@ const responseHandler = (responseParams) => {
});
}

// sending back 500 for retry
// At least one event in the batch is invalid.
if (status === 422) {
// sending back 500 for retry
throw new TransformerProxyError(
`ALGOLIA: Error transformer proxy v1 during ALGOLIA response transformation`,
500,
{
[tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(500),
},
destinationResponse,
'',
responseWithIndividualEvents,
);
}

throw new TransformerProxyError(
`ALGOLIA: Error transformer proxy v1 during ALGOLIA response transformation`,
500,
status,
{
[tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status),
},
destinationResponse,
getAuthErrCategoryFromStCode(status),
'',
responseWithIndividualEvents,
);
};
Expand Down
Loading

0 comments on commit 62ccafe

Please sign in to comment.