Ajout de la fonction de gestion des erreurs

doc
Rémi LAVERGNE 1 year ago
parent 7b3ff2b619
commit 7fce9bcbdc
No known key found for this signature in database
GPG Key ID: 8861D8A4AD21A032

@ -0,0 +1,77 @@
/**
* @file errorHandling.c
* @brief Gestion des erreurs
*/
#include "main.h"
/**
* @brief Fonction d'affichage des erreurs
* @param error: Code d'erreur
* @return void
*/
void errorHandling(int error)
{
//? Exemple d'erreurs (à adapter)
if (error < 0)
{
switch (error)
{
case -1:
printf("[ERREUR] - L'utilisateur a quitté.\n");
break;
case -2:
printf("[ERREUR] - La taille physique du tableau est dépassée.\n");
break;
case -3:
printf("[ERREUR] - L'identifiant doit être positif.\n");
break;
case -4:
printf("[ERREUR] - L'identifiant n'existe pas.\n");
break;
case -5:
printf("[ERREUR] - Le poids doit être positif.\n");
break;
case -6:
printf("[ERREUR] - Le volume doit être positif.\n");
break;
case -7:
printf("[ERREUR] - Le prix unitaire doit être positif.\n");
break;
case -8:
printf("[ERREUR] - La quantité doit être positive.\n");
break;
case -9:
printf("[ERREUR] - La référence doit être positive.\n");
break;
case -10:
printf("[ERREUR] - La référence n'existe pas.\n");
break;
case -11:
printf("[ERREUR] - La référence existe déjà.\n");
break;
default:
printf("[ERREUR] - Une erreur s'est produite.\n");
break;
}
}
}
void debugHandling(int code)
{
switch(code)
{
case 1:
printf("DEBUG: La fonction a été appelée.\n");
break;
case 2:
printf("DEBUG: La fonction a été appelée et s'est terminée correctement.\n");
break;
case 3:
printf("DEBUG: La fonction a été appelée et s'est terminée avec une erreur.\n");
break;
default:
printf("DEBUG: La fonction a été appelée avec un code inconnu.\n");
break;
}
}
Loading…
Cancel
Save