[Feature Request] Raise MSAL specific error, instead of base error `ValueError`, `RuntimeError`
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Start by reading the linked discussion from pull request #443 and the Azure CLI error handling examples in the linked files. The issue proposes MSAL-specific exception types derived from base Python errors, such as AuthorityError or MsalValueError, but leaves the API and set of errors to define. Done means MSAL raises identifiable errors for these scenarios so callers can handle them centrally; the thread has had no comment for over three years.
索引モデルが issue の本文から書いたものです。
説明
Originally from https://github.com/AzureAD/microsoft-authentication-library-for-python/pull/443#discussion_r895288236
Currently, MSAL raises Python's base error ValueError for scenarios such as tenant validation failure. Azure CLI can't really tell whether the error comes from MSAL or other places if we use a centralized error handling logic.
Now we handle all PersistenceError (https://github.com/AzureAD/microsoft-authentication-extensions-for-python/pull/108) in a centralized place:
elif isinstance(ex, PersistenceError):
# errno is already in strerror. str(ex) gives duplicated errno.
az_error = azclierror.CLIInternalError(ex.strerror)
if ex.errno == 0:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/20278")
elif ex.errno == -2146893813:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/20231")
elif ex.errno == -2146892987:
az_error.set_recommendation(
"Please report to us via Github: https://github.com/Azure/azure-cli/issues/21010")
This saves us from the necessity of capturing the error and handing it in all "joints" with MSAL.
But for this ValueError, we will have to capture it everywhere when MSAL interaction is made:
result = self._msal_app.acquire_token_interactive(
scopes, prompt='select_account', port=8400 if self._is_adfs else None,
success_template=success_template, error_template=error_template, **kwargs)
result = self._msal_app.acquire_token_by_device_flow(flow, **kwargs) # By default it will block
If we don't handle the error, the raw exception with traceback is shown, like in https://github.com/Azure/azure-cli/issues/20507, which is of course bad user experience.
I am thinking maybe MSAL can do the same for this ValueError (and other base error types raised) and create new error types which inherent from ValueError, such as AuthorityError, MsalValueError.
- 主要言語
- Python
- スター
- 971
- フォーク
- 223
- 平均マージ
- 13時間 48分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AzureAD/microsoft-authentication-library-for-python のほかの issue
-
needs attention untriaged
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
AzureSDK bug P1
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
http_client docstring does not say that timeout, verify and proxies only configure the default session対応中かも @HardMax71 が 39 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
-
[Bug] The built-in retry never retries the token POST: HTTPAdapter(max_retries=1) keeps urllib3's default allowed_methods対応中かも @HardMax71 が 45 日前に担当しました。 オープンbug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
AzureAD/microsoft-authentication-library-for-python#957 · コメント 3 件 ·
-
public-client untriaged
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
AzureAD/microsoft-authentication-library-for-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mohitmishra786/readprism#322 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
API-key credentials accept a blank key: empty via the API, spaces-only via the builder's Add API key dialog対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Significant-Gravitas/AutoGPT#15727 ·
メンテナーはふだん 1 日以内に返信