Skip to content

Commit 9750b0b

Browse files
committed
Include the HTTP resp content/errCode in auth error
Signed-off-by: Wei Zhang <[email protected]>
1 parent fedf9fb commit 9750b0b

File tree

1 file changed

+8
-5
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/serverexplore/ui

1 file changed

+8
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/serverexplore/ui/AddNewClusterFrom.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import com.intellij.openapi.application.ModalityState;
2828
import com.intellij.openapi.project.Project;
2929
import com.intellij.openapi.ui.DialogWrapper;
30-
import com.intellij.openapi.ui.popup.IconButton;
3130
import com.microsoft.azure.hdinsight.common.ClusterManagerEx;
3231
import com.microsoft.azure.hdinsight.sdk.cluster.HDInsightAdditionalClusterDetail;
3332
import com.microsoft.azure.hdinsight.sdk.common.AuthenticationException;
34-
import com.microsoft.azure.hdinsight.sdk.common.HDIException;
3533
import com.microsoft.azure.hdinsight.sdk.storage.HDStorageAccount;
36-
import com.microsoft.azure.hdinsight.serverexplore.AddHDInsightAdditionalClusterImpl;
3734
import com.microsoft.azure.hdinsight.serverexplore.hdinsightnode.HDInsightRootModule;
3835
import com.microsoft.azure.hdinsight.spark.jobs.JobUtils;
3936
import com.microsoft.azuretools.azurecommons.helpers.AzureCmdException;
@@ -232,9 +229,15 @@ protected void doOKAction() {
232229

233230
ClusterManagerEx.getInstance().addHDInsightAdditionalCluster(hdInsightAdditionalClusterDetail);
234231
hdInsightModule.refreshWithoutAsync();
235-
} catch (Exception ignore) {
232+
} catch (AuthenticationException authErr) {
236233
isCarryOnNextStep = false;
237-
errorMessage = "Wrong username/password to log in";
234+
errorMessage = "Authentication Error: " + Optional.ofNullable(authErr.getMessage())
235+
.filter(msg -> !msg.isEmpty())
236+
.orElse("Wrong username/password") +
237+
" (" + authErr.getErrorCode() + ")";
238+
} catch (Exception ex) {
239+
isCarryOnNextStep = false;
240+
errorMessage = "Authentication Error: " + ex.getMessage();
238241
}
239242
}
240243
}

0 commit comments

Comments
 (0)