diff --git a/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 b/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 index f27f39b..fa77479 100644 Binary files a/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 and b/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/DigitalData.Core/v17/.suo b/.vs/DigitalData.Core/v17/.suo index a1ef259..52a5dbc 100644 Binary files a/.vs/DigitalData.Core/v17/.suo and b/.vs/DigitalData.Core/v17/.suo differ diff --git a/DigitalData.Core.API/ControllerExtensions.cs b/DigitalData.Core.API/ControllerExtensions.cs index e741da4..fba7cfc 100644 --- a/DigitalData.Core.API/ControllerExtensions.cs +++ b/DigitalData.Core.API/ControllerExtensions.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using System.Text; namespace DigitalData.Core.API { @@ -22,5 +23,26 @@ namespace DigitalData.Core.API viewResult.ViewData[index] = value; return viewResult; } + + /// + /// Returns an ObjectResult representing an internal server error (status code 500) with optional exception and message details. + /// + /// The ControllerBase instance representing the controller. + /// Optional. The exception that occurred, if any. + /// Optional. A custom error message to include in the response. + /// /// Optional. A custom error message key to include in the response. + /// An ObjectResult representing an internal server error (status code 500). + public static ObjectResult InnerServiceError(this ControllerBase controllerBase, Exception? ex = null, string? message = null, Enum? messageKey = null) + { + var sb = new StringBuilder(); + if (ex is not null) + sb.AppendLine(ex.Message); + if (message is not null) + sb.AppendLine(message); + if (messageKey is not null) + sb.AppendLine(messageKey.ToString()); + + return controllerBase.StatusCode(500, sb.Length > 0 ? sb.ToString() : null); + } } } \ No newline at end of file diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache index c3e677f..930a9a6 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache and b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache differ diff --git a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache index b9f4d3d..7d27913 100644 Binary files a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache and b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache differ diff --git a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache index 3829cb8..1e9e175 100644 Binary files a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache and b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache differ