|
| 1 | +namespace Modular.Monolithic.Architecture.Helper.Domain.Errors; |
| 2 | + |
| 3 | +public class DomainErrors |
| 4 | +{ |
| 5 | + public static class General |
| 6 | + { |
| 7 | + public static Error ValueMaxLenght(string field = "", int max = 0) |
| 8 | + { |
| 9 | + return new Error("General.ValueMaxLenght", $"{field} has max lenght to {max}"); |
| 10 | + } |
| 11 | + |
| 12 | + public static Error ValueMinLenght(string field = "", int max = 0) |
| 13 | + { |
| 14 | + return new Error("General.ValueMaxLenght", $"{field} has max lenght to {max}"); |
| 15 | + } |
| 16 | + |
| 17 | + public static Error ListNullOrEmpty(string field = "") |
| 18 | + { |
| 19 | + return new Error("General.ListNullOrEmpty", $"{field} is null or empty."); |
| 20 | + } |
| 21 | + |
| 22 | + public static Error ValueNullOrEmpty(string field = "") |
| 23 | + { |
| 24 | + return new Error("General.ValueNullOrEmpty", $"{field} is null or empty."); |
| 25 | + } |
| 26 | + |
| 27 | + public static Error ItemNotFound(string itemname = "") |
| 28 | + { |
| 29 | + return new Error("General.ItemNotFound", $"{itemname} not found."); |
| 30 | + } |
| 31 | + |
| 32 | + public static Error UnProcessableRequest => new("General.UnProcessableRequest", "The server could not process the request."); |
| 33 | + |
| 34 | + public static Error ServerError => new("General.ServerError", "The server encountered an unrecoverable error."); |
| 35 | + |
| 36 | + public static Error ErrorDecriptData(string datafild) |
| 37 | + { |
| 38 | + return new Error("General.DecriptData", $"Error on decript data filed {datafild}."); |
| 39 | + } |
| 40 | + |
| 41 | + public static Error ErrorEncryptData(string datafild) |
| 42 | + { |
| 43 | + return new Error("General.DecriptData", $"Error on encrypt data filed {datafild}."); |
| 44 | + } |
| 45 | + } |
| 46 | +} |
0 commit comments