use of com.microsoft.azuretools.exception.AzureRuntimeException in project azure-tools-for-java by Microsoft.
the class AzureModule method composeName.
private static String composeName() {
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
if (AuthMethodManager.getInstance().isRestoringSignIn()) {
return BASE_MODULE_NAME + " (Signing In...)";
}
// not signed in
if (azureManager == null) {
return BASE_MODULE_NAME + " (Not Signed In)";
}
SubscriptionManager subscriptionManager = azureManager.getSubscriptionManager();
List<SubscriptionDetail> subscriptionDetails = subscriptionManager.getSubscriptionDetails();
List<SubscriptionDetail> selectedSubscriptions = subscriptionDetails.stream().filter(SubscriptionDetail::isSelected).collect(Collectors.toList());
return String.format("%s (%s)", BASE_MODULE_NAME, getAccountDescription(selectedSubscriptions));
} catch (AzureRuntimeException e) {
DefaultLoader.getUIHelper().showInfoNotification(ERROR_GETTING_SUBSCRIPTIONS_TITLE, ErrorEnum.getDisplayMessageByCode(e.getCode()));
} catch (Exception e) {
final String msg = String.format(ERROR_GETTING_SUBSCRIPTIONS_MESSAGE, e.getMessage());
DefaultLoader.getUIHelper().showException(msg, e, ERROR_GETTING_SUBSCRIPTIONS_TITLE, false, true);
}
return BASE_MODULE_NAME;
}
Aggregations