From 71b2de41764df6f5fc071c81a3ecd750eda14ee2 Mon Sep 17 00:00:00 2001 From: jboinembalome Date: Mon, 9 Nov 2020 14:38:35 +0100 Subject: [PATCH] MAJ des exceptions --- EPAServeur/Controllers/FormationsApi.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/EPAServeur/Controllers/FormationsApi.cs b/EPAServeur/Controllers/FormationsApi.cs index b9fe56e..f9df2b3 100644 --- a/EPAServeur/Controllers/FormationsApi.cs +++ b/EPAServeur/Controllers/FormationsApi.cs @@ -217,6 +217,10 @@ namespace IO.Swagger.Controllers { 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) { logger.LogError("Aucune formation ne correspond à l'id {idFormation} recherchée.", idFormation); @@ -229,14 +233,6 @@ namespace IO.Swagger.Controllers 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) { logger.LogError("Une erreur inconnue est survenue lors de la récupération de la formation {idFormation}.", idFormation);