feat: Improve error handling while communicating with Marketplace #35005
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.
Proposed changes (including videos or screenshots)
Introduce a new MarketplaceErrorHandler class that is going to be responsible for parsing marketplace-api errors and return the according error message strings from it.
Issue(s)
Steps to test or reproduce
Since we depend on having marketplace throwing errors to test this feature, I created a simple application that works as a proxy for marketplace, you can check it over here: https://github.com/Gustrb/api-stubber
It is pretty simple, and to run Rocket.Chat pointing at it instead of the actual marketplace one can simply:
Note: This assumes you are running the proxy at port 3001, while the default is 3000, this is done since the Rocket.Chat default port is also 3000.
Then, to test specific errors, you can tweak the
config.json
fileFurther comments
CONN-64