dataProvider delete method only throw Internal Server Error message for errors
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- react, typescript
Línea de trabajo
Comienza con la ruta de eliminación de dataProvider y las ubicaciones de fetchHydra.js y HttpError.js mostradas en la traza de la consola. Compara el manejo de errores de eliminación con las rutas PUT, POST y GET, y verifica después que una respuesta de error HTTP que contenga hydra:description produzca ese mensaje en lugar del error interno genérico del servidor.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
API Platform Admin version(s) affected: 3.4.5
Description
Using the useDelete hook, APIP-Admin only throw an 'Internal Server Error' error, even if the API return an error message.
For example, on the API side I have this:
throw new EntityDeleteForeignKeyException(
$this->translator->trans(
'error.entity.my_entity.delete.has_foreign_key',
[
'%my_entity%' => $item->value,
'%entity_linked%' => $this->translator->trans('entity.my_other_entity'),
]
)
);
This code return a 409 http status code, with the following body:
"@context": "/contexts/Error"
"@type": "hydra:Error"
"hydra:description": "My Error Message"
"hydra:title": "An error occurred"
Wich is at this point the intended behavior so there is no problem.
But then, on the admin side, when we delete the entity and we get a 409 response (in fact, no matter the status code, the result is the same for every HTTP errors), the APIP-admin dataProvider thrown an internal server error and does not take the hydra:description like it do with other methods (PUT, POST, GET...).
This is what is shown in the console when this occurs:
Error
at new HttpError (HttpError.js:33:23)
at eval (fetchHydra.js:53:39)
Aditionnal Context:
- If I remember well, the same type of error happens a while back, when the delete method return a 204 status (maybe it is linked to this https://github.com/api-platform/admin/issues/440)
- This may be a duplicate of this issue: https://github.com/api-platform/admin/issues/381, but as there where no activity since 2021, I didn't knew if it was ok to just add a comment or if I needed to create a new one
- Lenguaje dominante
- TypeScript
- Estrellas
- 516
- Forks
- 134
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 api-platform/admin
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
api-platform/admin#616 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
api-platform/admin#660 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
api-platform/admin#659 · 1 reacción ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
api-platform/admin#631 · 6 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
api-platform/admin#626 · 1 comentario · 1 reacción ·
Todos los issues de api-platform/admin
Issues similares
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Mend: dependency security vulnerability untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100