Skip to content

Commit

Permalink
fix: handle upgrade subscription message (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzerk authored Apr 4, 2023
1 parent 88ae567 commit 59d0a84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/crowdin/cli/client/CrowdinClientCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ abstract class CrowdinClientCore {
new LinkedHashMap<BiPredicate<String, String>, RuntimeException>() {{
put((code, message) -> code.equals("401"),
new RuntimeException(RESOURCE_BUNDLE.getString("error.response.401")));
put((code, message) -> code.equals("403") && message.contains("upgrade your subscription plan to upload more file formats"),
new RuntimeException(RESOURCE_BUNDLE.getString("error.response.403_upgrade_subscription")));
put((code, message) -> code.equals("403"),
new RuntimeException(RESOURCE_BUNDLE.getString("error.response.403")));
put((code, message) -> code.equals("404") && StringUtils.containsIgnoreCase(message, "Project Not Found"),
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ error.pre_translate.auto_approve_option=Wrong '--auto-approve-option' parameter.

error.response.401=Couldn't authorize. Check your 'api_token'.
error.response.403=You do not have permission to view/edit project with provided id.
error.response.403_upgrade_subscription=Please, upgrade your subscription plan to upload more file formats.
error.response.404_project_not_found=Project with provided id doesn't exist.
error.response.404_organization_not_found=No organization is located at this url. Check your 'base_url'
error.response.url_not_known=Invalid url. check your 'base_url'
Expand Down

0 comments on commit 59d0a84

Please sign in to comment.