FIxing issues

This commit is contained in:
2025-03-28 22:32:24 +01:00
parent 366962abfa
commit a648a2ea77
5 changed files with 10 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ public class RoleController_Tests
{ {
IConfiguration configuration = TestUtils.CreateConfiguration(); IConfiguration configuration = TestUtils.CreateConfiguration();
_roleServiceMock = new Mock<IRoleService>(); _roleServiceMock = new Mock<IRoleService>();
_roleController = new RoleController(configuration, _roleServiceMock?.Object); _roleController = new RoleController(configuration, _roleServiceMock.Object);
} }
[TestMethod] [TestMethod]

View File

@@ -55,7 +55,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";

View File

@@ -13,6 +13,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
protected readonly IConfiguration _configuration; protected readonly IConfiguration _configuration;
protected readonly AppSettings _appSettings; protected readonly AppSettings _appSettings;
protected readonly string _requestNotWellFormed = "Request is not well formed"; protected readonly string _requestNotWellFormed = "Request is not well formed";
protected readonly string _somethingWentWrong = "Something went wrong";
protected BaseController( protected BaseController(
IConfiguration configuration IConfiguration configuration

View File

@@ -54,7 +54,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";
@@ -105,7 +105,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";
@@ -170,7 +170,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";
@@ -212,7 +212,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";

View File

@@ -57,7 +57,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";
@@ -118,7 +118,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
} }
catch (Exception exception) catch (Exception exception)
{ {
var message = "Something went wrong"; var message = this._somethingWentWrong;
if (!String.IsNullOrEmpty(exception.Message)) if (!String.IsNullOrEmpty(exception.Message))
{ {
message += $". {exception.Message}"; message += $". {exception.Message}";