commit 9373d5848a5410b816505dcaa53a1b97aa2c29b4 Author: Hadi Khazaee Asl Date: Thu Jan 25 04:35:39 2024 +0330 Initial Commit ... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bd9d0b --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# +# DotNet ... +bin +obj + +# +# Natural Docs ... +Documentation/* diff --git a/Attributes/StringValueAttribute.cs b/Attributes/StringValueAttribute.cs new file mode 100644 index 0000000..1a66b51 --- /dev/null +++ b/Attributes/StringValueAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace xExceptions.Attributes +{ + /// + /// an attribute which attached to enums to carry propper string + /// + public partial class StringValueAttribute : System.Attribute { + public string StringValue { get; set; } + + public StringValueAttribute (string value) { + this.StringValue = value; + } + } +} diff --git a/Constants/XException.cs b/Constants/XException.cs new file mode 100644 index 0000000..c60eab5 --- /dev/null +++ b/Constants/XException.cs @@ -0,0 +1,214 @@ +using xExceptions.Attributes; + +namespace xExceptions.Constants +{ + public enum XException { + // + #region Invalid Exceptions 1xx ... + [StringValue ("Invalid Data ...")] + InvalidData = 100, + + // + [StringValue ("Invalid Date ...")] + InvalidDate = 101, + + // + [StringValue ("Bad Request ...")] + BadRequest = 102, + + // + [StringValue ("Invalid Args ...")] + InvalidArgs = 103, + + // + [StringValue ("Invalid Message ...")] + InvalidMessage = 104, + + // + [StringValue ("Invalid Token ...")] + InvalidToken = 105, + + // + [StringValue ("Invalid Verification Code ...")] + InvalidVerificationCode = 106, + + // + [StringValue ("Invalid Email Address ...")] + InvalidEmailAddress = 107, + + // + [StringValue ("Invalid Mobile Number ...")] + InvalidMobileNumber = 108, + + // + [StringValue ("Invalid Password ...")] + InvalidPassword = 109, + + // + [StringValue ("Inavlid Url ...")] + InavlidUrl = 110, + + // + [StringValue ("Invalid Device ...")] + InvalidDevice = 111, + + // + [StringValue ("Invalid Profile Image ...")] + InvalidProfileImage = 112, + + // + [StringValue ("Invalid File ...")] + InavlidFile = 113, + + // + [StringValue ("Invalid Username ...")] + InvalidUserName = 114, + #endregion + + // + #region Not (...) Exceptions 2xx ... + // + [StringValue ("Not Found ...")] + NotFound = 200, + + // + [StringValue ("Not Allowed ...")] + NotAllowed = 201, + + // + [StringValue ("Not Authorized ...")] + NotAuthorized = 202, + + // + [StringValue ("Not Visible ...")] + NotVisible = 203, + #endregion + + // + #region User/Registration/Account/Bann Exceptions 3xx ... + // + [StringValue ("Account Locked out Until:{0}")] + AccountLockedOut = 300, + + // + [StringValue ("Login Failed ...")] + LoginFailed = 301, + + // + [StringValue ("User Registered Before ...")] + UserRegisteredBefore = 302, + + // + [StringValue ("User Disabled ...")] + UserDisabled = 303, + // + [StringValue ("Device Banned Until:{0}")] + DeviceBanned = 304, + + // + [StringValue ("You can't Request Verification code Until:{0}")] + VerificationCodeResendNotAllowed = 305, + + // + [StringValue ("Passwords Same ...")] + PasswordsSame = 306, + + // + [StringValue ("Mobiles Same ...")] + MobilesSame = 307, + + // + [StringValue ("Emails Same ...")] + EmailsSame = 308, + + // + [StringValue ("Mobile In Used ...")] + MobileInUsed = 309, + + // + [StringValue ("Email In Used ...")] + EmailInUsed = 310, + + // + [StringValue ("Mobile Not Confirmed ...")] + MobileNotConfirmed = 311, + + // + [StringValue ("Email Not Confirmed ...")] + EmailNotConfirmed = 312, + + // + [StringValue ("Post Banned ...")] + PostBanned = 313, + + // + [StringValue ("User Banned ...")] + UserBanned = 314, + #endregion + + // + #region General Exceptions 4xx ... + // + [StringValue ("Unknown Error ...")] + Unknown = 400, + + // + [StringValue ("Duplicate ...")] + Duplicate = 401, + + // + [StringValue ("Action Failed ...")] + ActionFailed = 402, + + // + [StringValue ("Expired Date ...")] + ExpiredDate = 403, + + // + [StringValue ("Unavailable ...")] + Unavailable = 404, + + // + [StringValue ("Max Allowed Tag Exceeded ...")] + MaxAllowedTagExceeded = 405, + + // + [StringValue ("Timed out ...")] + Timeout = 406, + #endregion + + // + #region File Exceptions 5xx ... + // + [StringValue ("Empty File ...")] + EmptyFile = 500, + + // + [StringValue ("max File size exceeded ...")] + MaxFileSizeExceeded = 501, + + // + [StringValue ("Unsupported File Type ...")] + UnsupportedFileType = 502, + + // + [StringValue ("Max Allowed Media Exceeded ...")] + MaxAllowedMediaExceeded = 503, + #endregion + + // + #region Configuration Exceptions 6xx ... + // + [StringValue ("Invalid Configuration ...")] + InvalidConfiguration = 600, + + // + [StringValue ("Storage Service Initiallization Failed ...")] + StorageServiceInitialFailed = 601, + + // + [StringValue ("Message Service Initialization Failed ...")] + MessageServiceInitialFailed = 602, + #endregion + } +} \ No newline at end of file diff --git a/Extensions/.gitkeep b/Extensions/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Models/XError.cs b/Models/XError.cs new file mode 100644 index 0000000..09c8001 --- /dev/null +++ b/Models/XError.cs @@ -0,0 +1,15 @@ +namespace xExceptions.Models { + public partial class XError { + /// + /// th ID of Error + /// + /// + public int Id { get; set; } + + /// + /// the String Value of Error + /// + /// + public string Message { get; set; } + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..421e137 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# xExceptions + +it is a Part of xDashboard on SaherElm IT Center which provides: + +- All Exceptions and its related Extensions. + +this module has no dependency and itself. + +## Maintainer + +Hadi Khazaee asl + +[https://www.saherelm.ir](https://www.saherelm.ir) + +[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com) diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..87b6eb0 --- /dev/null +++ b/nuget.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/xExceptions.csproj b/xExceptions.csproj new file mode 100644 index 0000000..230b255 --- /dev/null +++ b/xExceptions.csproj @@ -0,0 +1,22 @@ + + + + + netstandard2.0 + xDashboard.xExceptions + 1.0.0 + Hadi Khazaee Asl + SaherElm IT Center + + provide all Exceptions and its related actions/extensions and classes which required to xDashboard project. + + + + icon.png + + + + + + +