Fixed missing SearchdomainAlreadyExistsException in SearchdomainManager
This commit is contained in:
3
src/Server/Exceptions/SearchdomainExceptions.cs
Normal file
3
src/Server/Exceptions/SearchdomainExceptions.cs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
namespace Server.Exceptions;
|
||||||
|
public class SearchdomainNotFoundException(string searchdomainName) : Exception($"Searchdomain with name {searchdomainName} not found.") { }
|
||||||
|
public class SearchdomainAlreadyExistsException(string searchdomainName) : Exception($"Searchdomain with name {searchdomainName} already exists.") { }
|
||||||
@@ -2,6 +2,7 @@ using MySql.Data.MySqlClient;
|
|||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using Server.Migrations;
|
using Server.Migrations;
|
||||||
using Server.Helper;
|
using Server.Helper;
|
||||||
|
using Server.Exceptions;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ public class SearchdomainManager
|
|||||||
if (searchdomains.TryGetValue(searchdomain, out Searchdomain? value))
|
if (searchdomains.TryGetValue(searchdomain, out Searchdomain? value))
|
||||||
{
|
{
|
||||||
_logger.LogError("Searchdomain {searchdomain} could not be created, as it already exists", [searchdomain]);
|
_logger.LogError("Searchdomain {searchdomain} could not be created, as it already exists", [searchdomain]);
|
||||||
throw new Exception("Searchdomain already exists"); // TODO create proper SearchdomainAlreadyExists exception
|
throw new SearchdomainAlreadyExistsException(searchdomain);
|
||||||
}
|
}
|
||||||
Dictionary<string, dynamic> parameters = new()
|
Dictionary<string, dynamic> parameters = new()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user