ExceptionLibrary.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Quadarax.Foundation.Core.Exceptions;
  2. namespace Quadarax.Application.QLiberace.Common
  3. {
  4. public class ExceptionLibrary : ExceptionCodes
  5. {
  6. protected override void OnSetupCodes()
  7. {
  8. AddCode(ExceptionsCodes.ValidationErrorsCode, ExceptionsCodes.ValidationErrorsMsg);
  9. AddCode(ExceptionsCodes.SettingsNotFoundCode, ExceptionsCodes.SettingsNotFoundMsg);
  10. AddCode(ExceptionsCodes.SettingsNotFoundForModuleCode, ExceptionsCodes.SettingsNotFoundForModuleMsg);
  11. AddCode(ExceptionsCodes.SettingsHasNoPropertyCode, ExceptionsCodes.SettingsHasNoPropertyMsg);
  12. AddCode(ExceptionsCodes.SettingsAlreadyExistsCode, ExceptionsCodes.SettingsAlreadyExistsMsg);
  13. AddCode(ExceptionsCodes.TenantNotFoundCode, ExceptionsCodes.TenantNotFoundMsg);
  14. AddCode(ExceptionsCodes.TenantAlreadyExistsCode, ExceptionsCodes.TenantAlreadyExistsMsg);
  15. AddCode(ExceptionsCodes.TenantLockedCode, ExceptionsCodes.TenantLockedMsg);
  16. AddCode(ExceptionsCodes.TenantDifferentContextCode, ExceptionsCodes.TenantDifferentContextMsg);
  17. AddCode(ExceptionsCodes.UserNotFoundCode, ExceptionsCodes.UserNotFoundMsg);
  18. AddCode(ExceptionsCodes.UserAlreadyExistsCode, ExceptionsCodes.UserAlreadyExistsMsg);
  19. }
  20. public static class ExceptionsCodes
  21. {
  22. public const string ValidationErrorsMsg = "Validation errors follows:";
  23. public const int ValidationErrorsCode = 1000;
  24. public const string SettingsNotFoundMsg = "Setting '{0}' not found fo module '{1}'";
  25. public const int SettingsNotFoundCode = 10000;
  26. public const string SettingsNotFoundForModuleMsg = "Any setting not found for module '{0}'";
  27. public const int SettingsNotFoundForModuleCode = 10001;
  28. public const string SettingsHasNoPropertyMsg = "Setting '{0}' has no defined property in class '{1}'";
  29. public const int SettingsHasNoPropertyCode = 10002;
  30. public const string SettingsAlreadyExistsMsg = "Setting '{0}' for module '{1}' already exists.";
  31. public const int SettingsAlreadyExistsCode = 10003;
  32. public const string TenantNotFoundMsg = "Tenant with identifier {0}='{1}' not found";
  33. public const int TenantNotFoundCode = 10010;
  34. public const string TenantAlreadyExistsMsg = "Tenant with code '{0}' already exists";
  35. public const int TenantAlreadyExistsCode = 10011;
  36. public const string TenantLockedMsg = "Tenant with code '{0}' is LOCKED! Cannot access.";
  37. public const int TenantLockedCode = 10012;
  38. public const string TenantDifferentContextMsg = "Cannot update different Tenant with code '{0}' in tenant context '{1}'";
  39. public const int TenantDifferentContextCode = 10013;
  40. public const string UserNotFoundMsg = "User with identifier {0}='{1}' not found";
  41. public const int UserNotFoundCode = 10020;
  42. public const string UserAlreadyExistsMsg = "User with login name '{0}' already exists";
  43. public const int UserAlreadyExistsCode = 10021;
  44. }
  45. }
  46. }