diff --git a/src/JsonApiDotNetCore/Internal/JsonApiExceptionFactory.cs b/src/JsonApiDotNetCore/Internal/JsonApiExceptionFactory.cs index 41d676f5da..7e251ebae0 100644 --- a/src/JsonApiDotNetCore/Internal/JsonApiExceptionFactory.cs +++ b/src/JsonApiDotNetCore/Internal/JsonApiExceptionFactory.cs @@ -15,8 +15,19 @@ public static JsonApiException GetException(Exception exception) case "InvalidCastException": return new JsonApiException("409", exception.Message); default: - return new JsonApiException("500", exception.Message); + return new JsonApiException("500", exception.Message, GetExceptionDetail(exception.InnerException)); } } + + private static string GetExceptionDetail(Exception exception) + { + string detail = null; + while(exception != null) + { + detail = $"{detail}{exception.Message}; "; + exception = exception.InnerException; + } + return detail; + } } }