Skip to content

Conversation

@MartinakDaniel
Copy link
Contributor

Github issue (delete if this does not apply)

There is no issue for this bug.

PR's key points

When the PoEditor API response does not contain a result field then the JSON parser throws an exception (com.squareup.moshi.JsonDataException: Required value 'result' missing at $).

For example: when gets the project languages (getProjectLanguages) and the API token is valid but does not have a permission for the PoEditor project then the API response this:

POST https://api.poeditor.com/v2/languages/list {	"response": {	"status": "fail",	"code": "403",	"message": "You don't have permission to access this resource"	} } 

It does not contain a result field and the JSON parser throws an exception (JsonDataException). It can't reach the onSuccessful (PoEditorApiControllerImpl) method which would throw an IllegalStateException with the detailed error message.

How to review this PR?

Check if the responses handled correctly.

Copy link
Contributor

@adriangl adriangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MartinakDaniel! First of all, thanks a lot for the contribution 😁!

LGTM! I'll also take a look at expanding this solution to the rest of the PoEditor API calls in the project so we cover this case everywhere ;)

@adriangl adriangl merged commit 96bf357 into hyperdevs-team:master Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants