[Feature Request] Raise MSAL specific error, instead of base error `ValueError`, `RuntimeError`
還沒有人認領這個 Issue。
評估
- 難度
- 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 分鐘
- 30 天內合併 PR
- 2
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
AzureAD/microsoft-authentication-library-for-python 的其他 Issue
-
needs attention untriaged
難度 4/5 3-5 天 新手友好度 48/100
AzureAD/microsoft-authentication-library-for-python#973 · 1 則留言 ·
-
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 於 40 天前認領。 未關閉
難度 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 於 46 天前認領。 未關閉bug untriaged
難度 2/5 1-3 小時 新手友好度 35/100
AzureAD/microsoft-authentication-library-for-python#957 · 3 則留言 ·
-
public-client untriaged
難度 5/5 一週以上 新手友好度 25/100
查看 AzureAD/microsoft-authentication-library-for-python 的全部 Issue
相似的 Issue
-
documentation
難度 2/5 1-3 小時 新手友好度 67/100
維護者通常 1 天內回覆
-
good first issue module-baseline needs triage ux
難度 2/5 1-3 小時 新手友好度 82/100
darnitdevorg/darnit#650 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
nyjc-computing/campus#938 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
nf-osi/nf-metadata-dictionary#1027 ·
維護者通常 1 天內回覆
-
bug documentation
難度 1/5 1 小時以內 新手友好度 92/100
qatrackplus/qatrackplus#913 ·
維護者通常 3 天內回覆