From 3054b456dcb54f069a5d8aaa615c1dfe060eef9b Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 25 Apr 2024 06:31:52 +0200 Subject: Add projects logic, start of issues --- BugMine.Sdk/Exceptions/BugMineException.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 BugMine.Sdk/Exceptions/BugMineException.cs (limited to 'BugMine.Sdk/Exceptions') 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 -- cgit 1.5.1