fix(mojaloop/#3838): return 409 with proper errorInformation for duplicate participant registration - #294
Open
kaydendua wants to merge 10 commits into
Open
fix(mojaloop/#3838): return 409 with proper errorInformation for duplicate participant registration#294kaydendua wants to merge 10 commits into
kaydendua wants to merge 10 commits into
Conversation
…icipant registration
POST /oracle/participants/{Type}/{ID} throws a bare Error when the ID already exists, which falls through to a generic error response: 500, errorCode 2001, Internal server error. Now it returns 409 with errorCode 3003 (ADD_PARTY_INFO_ERROR) with an errorDescription
kaydendua
requested review from
bushjames,
elnyry-sam-k,
geka-evk,
gibaros,
kleyow,
oderayi,
shashi165 and
vijayg10
as code owners
August 10, 2026 11:55
| throw new Error(`ID:${request.params.ID} already exists`) | ||
| const errorObject = { | ||
| errorCode: 3003, | ||
| errorDescription: `Party already exists: ID:${request.params.ID}` |
Member
There was a problem hiding this comment.
lets have a consistent error description for both (ideally all but at least the ones we're touching here)
Member
|
also, can we have some unit tests, at least for the newly added code? thanks |
wrap the response in an errorInformation object
Author
|
Note: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POST /oracle/participants/{Type}/{ID} throws a bare Error when the ID already exists, which falls through to a generic error response: 500, errorCode 2001, Internal server error. This PR replaces the throw with an explicit 409 response with errorCode 3003 (ADD_PARTY_INFO_ERROR) with an errorDescription.
Note:
It seems like there might be similar issues in the same file that are outside of the scope of this issue:
createParticipantsBatchuses error code "1234" instead of "3003" for its participant already exists error.updateParticipantsByTypeIdanddelParticipantsByTypeId, which will cause the same issue of falling through to a generic 500 error response.Fixes mojaloop/project#3838