Skip to content

Commit

Permalink
chore: handle other error use-cases in reddit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Sankeerth committed Aug 29, 2024
1 parent 965e7f0 commit 359a8f3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/v0/destinations/reddit/networkHandler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const { RetryableError } = require('@rudderstack/integrations-lib');
const { RetryableError, TAG_NAMES, NetworkError } = require('@rudderstack/integrations-lib');
const isString = require('lodash/isString');
const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network');
const { isHttpStatusSuccess } = require('../../util/index');
const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants');
const logger = require('../../../logger');

const { processAxiosResponse } = require('../../../adapters/utils/networkUtils');
const {
processAxiosResponse,
getDynamicErrorType,
} = require('../../../adapters/utils/networkUtils');

const redditRespHandler = (destResponse) => {
const { status, response } = destResponse;
Expand All @@ -30,7 +32,14 @@ const redditRespHandler = (destResponse) => {
authErrorCategory,
);
}
logger.error(`Error in Reddit response transformation: ${JSON.stringify(destResponse)}`);
throw new NetworkError(
`${JSON.stringify(response)} during reddit response transformation`,
status,
{
[TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status),
},
destResponse,
);
};
const responseHandler = (responseParams) => {
const { destinationResponse } = responseParams;
Expand Down

0 comments on commit 359a8f3

Please sign in to comment.