Errors.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module.exports = {
  2. SUCCESS: 0,
  3. EPERM: 1,
  4. ENOENT: 2,
  5. EINVAL: 22,
  6. UNKNWON: -1,
  7. BAD_USER: -2,
  8. USER_EXISTS: -3,
  9. BAD_PROJECT: -4,
  10. PROJECT_EXISTS: -5,
  11. BAD_RES: -6,
  12. RES_EXISTS: -7,
  13. AUTH_FAILED: -8,
  14. messages :
  15. {
  16. '0' : ["Success", 200],
  17. '1': ["Opération interdite", 403],
  18. '2': ["Fichier introuvable", 404],
  19. '22': ["Mauvais argument(s)",400],
  20. '-1': ["Erreur inconnue", 400],
  21. '-2': ["Utilisateur inconnu", 400],
  22. '-3': ["Utilisateur déja existant", 400],
  23. '-4': ["Projet inconnu", 400],
  24. '-6': ["Ressource inconnue", 400],
  25. '-7': ["Ressource déjà existant", 400],
  26. '-5': ["Projet déjà existant", 400],
  27. '-8': ["Echec de l'authentification", 403]
  28. },
  29. check : function(x)
  30. {
  31. if(x==undefined || x==null || ( Number.isInteger(x) && x!=0) )
  32. return false;
  33. return true;
  34. }
  35. }