Azure / Azure/azure-libraries-for-java

[FEATURE REQ] Check subscription id early and provide more friendly error message

オープン
#945 コメント 1 件 リアクション 0 件 担当者 1 名 @weidongxu-microsoft が担当を希望しています GitHub で見る
Authentication Mgmt
主要言語
Java
スター
97
フォーク
102
PR マージ指標
30日以内にマージされた PR はありません

説明

**Is your feature request related to a problem? Please describe.**

We are building java toolkit based on azure java library, and we found the error message is a bit confusing when subscription is set to null. [Related issue](https://github.com/microsoft/azure-maven-plugins/issues/931). This could be reproduced when you auth with an Microsoft account without any subscription

**Describe the solution you'd like**
We could throw specific kind of Exception(like 'AzureAuthException') and show more friendly error message("Subscription Id is not specified"), or we could set error code to indicate this is an auth issue.

**Describe alternatives you've considered**
We could check subscription early, like in the auth stage
- We could check whether specified subs is exist and throw correspond exception in method [withSubscription](https://github.com/Azure/azure-libraries-for-java/blob/master/azure/src/main/java/com/microsoft/azure/management/Azure.java#L394)
- We could check whether there are available subscription in current account in method [withDefaultSubscription](https://github.com/Azure/azure-libraries-for-java/blob/master/azure/src/main/java/com/microsoft/azure/management/Azure.java#L399)

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Description Added
- [x] Expected solution specified

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。