Skip to content

Commit

Permalink
fix(mojaloop/2941): handled party lookup timeout error (#386)
Browse files Browse the repository at this point in the history
fix: handled-party-lookup-timeout-error
  • Loading branch information
vijayg10 authored Sep 22, 2022
1 parent 747f0fe commit 3ee88b1
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

const { PartyInfoRequestedDmEvt } = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
const { PartiesModel } = require('../../lib/model');
const { SDKStateEnum } = require('../../lib/model/common');
const { PartyInfoCallbackReceivedDmEvt } = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
const { Errors } = require('@mojaloop/sdk-standard-components');

module.exports.handlePartyInfoRequestedDmEvt = async (
message,
Expand Down Expand Up @@ -70,5 +72,22 @@ module.exports.handlePartyInfoRequestedDmEvt = async (
await options.producer.sendDomainEvent(partyInfoCallbackReceivedDmEvt);
} catch (err) {
logger.push({ err }).log('Error in handlePartyInfoRequestedDmEvt');
const { code, message } = Errors.MojaloopApiErrorCodes.SERVER_TIMED_OUT
const partyInfoCallbackReceivedDmEvt = new PartyInfoCallbackReceivedDmEvt({
bulkId: event.getKey(),
content: {
transferId: event.getTransferId(),
partyResult: {
currentState: SDKStateEnum.ERROR_OCCURRED,
errorInformation: {
errorCode: code,
errorDescription: message
}
},
},
timestamp: Date.now(),
headers: [],
});
await options.producer.sendDomainEvent(partyInfoCallbackReceivedDmEvt);
}
};

0 comments on commit 3ee88b1

Please sign in to comment.