1 files changed, 23 insertions, 0 deletions
diff --git a/BugMine.Sdk/Exceptions/BugMineException.cs b/BugMine.Sdk/Exceptions/BugMineException.cs
new file mode 100644
index 0000000..7e843b3
--- /dev/null
+++ b/BugMine.Sdk/Exceptions/BugMineException.cs
@@ -0,0 +1,23 @@
+using System.Diagnostics.CodeAnalysis;
+using LibMatrix;
+
+namespace BugMine.Web.Classes.Exceptions;
+
+public class BugMineException : MatrixException {
+ [SetsRequiredMembers]
+ public BugMineException(string errorCode, string? message = null) {
+ ErrorCode = errorCode;
+ Error = message ?? Message;
+ }
+
+ public sealed override string Message =>
+ $"{ErrorCode}: {ErrorCode switch {
+ // common
+ ErrorCodes.UserNotInRoom => "User is not in the room",
+ _ => base.Message
+ }}";
+
+ public new static class ErrorCodes {
+ public const string UserNotInRoom = "BUGMINE_USER_NOT_IN_ROOM";
+ }
+}
\ No newline at end of file
|