Skip to content

Commit

Permalink
refactor codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
shenqianjin committed Sep 29, 2020
1 parent b2624a3 commit ea62350
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ private static String composeName() {

} catch (Exception e) {
if (e instanceof AzureRuntimeException) {
DefaultLoader.getUIHelper().showInfoNotification(ERROR_GETTING_SUBSCRIPTIONS_TITLE
, ErrorUIMapEnum.getViewMessageByCode(((AzureRuntimeException) e).getCode()));
DefaultLoader.getUIHelper().showInfoNotification(
ERROR_GETTING_SUBSCRIPTIONS_TITLE, ErrorUIMapEnum.getViewMessageByCode(((AzureRuntimeException) e).getCode()));
} else {
final String msg = String.format(ERROR_GETTING_SUBSCRIPTIONS_MESSAGE, e.getMessage());
DefaultLoader.getUIHelper().showException(msg, e, ERROR_GETTING_SUBSCRIPTIONS_TITLE, false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@

/**
* Wrapper Entify for remote procedure call response.
* @TODOs try to seperate data and error into different classes.
*/
public class ResponseWrapper<T> extends BaseEntity {

private T data;
/**
* default is 0, and 0 means no error.
*/
private int errorCode;
private String errorMessage;
private String originalMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static ErrorUIMessageEnum getViewMessageEnumByCode(int code) {
return e.getViewMessage();
}
}
return null;
throw new IllegalArgumentException(String.format("Not found enum for code: %s", code));
}

public static String getViewMessageByCode(int code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public enum ErrorUIMessageEnum {

UNKNOWN_HOST_EXCEPTION("It seems you have an unstable network at the moment, please try again when network is available."),
SOCKET_TIMEOUT_EXCEPTION("Timeout when accessing azure, please try your operation again."),
FAILED_TO_GET_ACCESS_TOKEN_BY_CLI("Failed to get access token, please try to login azure cli using 'az login' and try again."),
FAILED_TO_GET_ACCESS_TOKEN_BY_CLI("Failed to get access token, please try to login Azure CLI using 'az login' and try again."),
;

private String text;
Expand Down

This file was deleted.

0 comments on commit ea62350

Please sign in to comment.