MAJ des exceptions

develop
jboinembalome 4 years ago
parent 03dd6302b2
commit 71b2de4176
  1. 12
      EPAServeur/Controllers/FormationsApi.cs

@ -217,6 +217,10 @@ namespace IO.Swagger.Controllers
{ {
formationDTO = await formationService.GetFormationByIdAsync(idFormation); formationDTO = await formationService.GetFormationByIdAsync(idFormation);
} }
catch (ArgumentNullException)
{
logger.LogError("L'argument passé dans la requête pour récupérer une formation est invalide.");
}
catch (FormationNotFoundException) catch (FormationNotFoundException)
{ {
logger.LogError("Aucune formation ne correspond à l'id {idFormation} recherchée.", idFormation); logger.LogError("Aucune formation ne correspond à l'id {idFormation} recherchée.", idFormation);
@ -229,14 +233,6 @@ namespace IO.Swagger.Controllers
return NotFound(erreurDTO); return NotFound(erreurDTO);
} }
catch (DbUpdateConcurrencyException)
{
logger.LogWarning("La formation {idFormation} n'a pas pu être récupérée car elle est prise par une autre ressource.", idFormation);
}
catch (DbUpdateException)
{
logger.LogError("Une erreur a eu lieu, la formation {idFormation} n'a pas pu être récupérée.", idFormation);
}
catch (Exception) catch (Exception)
{ {
logger.LogError("Une erreur inconnue est survenue lors de la récupération de la formation {idFormation}.", idFormation); logger.LogError("Une erreur inconnue est survenue lors de la récupération de la formation {idFormation}.", idFormation);

Loading…
Cancel
Save