[Feature Request] Raise MSAL specific error, instead of base error `ValueError`, `RuntimeError`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- authentication
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 971
- Forks
- 223
- Merge medio
- 13 h 48 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AzureAD/microsoft-authentication-library-for-python
-
needs attention untriaged
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
AzureSDK bug P1
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
http_client docstring does not say that timeout, verify and proxies only configure the default sessionPosiblemente ocupada @HardMax71 la tomó hace 39 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
-
[Bug] The built-in retry never retries the token POST: HTTPAdapter(max_retries=1) keeps urllib3's default allowed_methodsPosiblemente ocupada @HardMax71 la tomó hace 45 días. Abiertobug untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
AzureAD/microsoft-authentication-library-for-python#957 · 3 comentarios ·
-
public-client untriaged
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de AzureAD/microsoft-authentication-library-for-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
mihai-vlc/sublime-jsfmt#56 ·
-
comp/cli comp/plugins P2 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NousResearch/hermes-agent#141917 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Go device SDK: Whisper transcriber keeps buffering and transcribing audio appended after Stop()Posiblemente ocupada @apoorvdarshan la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BasedHardware/omi#22770 ·
Los mantenedores suelen responder en 1 día
-
bug needs-acceptance wg/router-models-inference-runtime
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
vllm-project/semantic-router#5295 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
huggingface/huggingface_hub#5210 ·
Los mantenedores suelen responder en 1 día