[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
-
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 于 38 天前认领。 未关闭
难度 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 一周以上 新手友好度 25/100
查看 AzureAD/microsoft-authentication-library-for-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
google-ai-edge/litert-torch#1346 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
geneontology/gocam-py#272 ·
-
pushed_authorization_request sends list authorization_details as a Python repr可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
auth0/auth0-python#903 ·
维护者通常 1 天内回复