about summary refs log tree commit diff
path: root/BugMine.Sdk/Exceptions/BugMineException.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-04-25 06:31:52 +0200
committerRory& <root@rory.gay>2024-04-25 06:31:52 +0200
commit3054b456dcb54f069a5d8aaa615c1dfe060eef9b (patch)
treece89fbd1478206ac19fefa23035b68801bd25d4e /BugMine.Sdk/Exceptions/BugMineException.cs
parentAdd basic project management (diff)
downloadBugMine-3054b456dcb54f069a5d8aaa615c1dfe060eef9b.tar.xz
Add projects logic, start of issues
Diffstat (limited to 'BugMine.Sdk/Exceptions/BugMineException.cs')
-rw-r--r--BugMine.Sdk/Exceptions/BugMineException.cs23
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