diff --git a/src/JsonApiDotNetCore/Internal/Error.cs b/src/JsonApiDotNetCore/Internal/Error.cs index 999611d79e..71852e28ea 100644 --- a/src/JsonApiDotNetCore/Internal/Error.cs +++ b/src/JsonApiDotNetCore/Internal/Error.cs @@ -9,9 +9,9 @@ public class Error { public Error() { } - + [Obsolete("Use Error constructors with int typed status")] - public Error(string status, string title, ErrorMeta meta = null, string source = null) + public Error(string status, string title, ErrorMeta meta = null, object source = null) { Status = status; Title = title; @@ -19,7 +19,7 @@ public Error(string status, string title, ErrorMeta meta = null, string source = Source = source; } - public Error(int status, string title, ErrorMeta meta = null, string source = null) + public Error(int status, string title, ErrorMeta meta = null, object source = null) { Status = status.ToString(); Title = title; @@ -28,7 +28,7 @@ public Error(int status, string title, ErrorMeta meta = null, string source = nu } [Obsolete("Use Error constructors with int typed status")] - public Error(string status, string title, string detail, ErrorMeta meta = null, string source = null) + public Error(string status, string title, string detail, ErrorMeta meta = null, object source = null) { Status = status; Title = title; @@ -37,7 +37,7 @@ public Error(string status, string title, string detail, ErrorMeta meta = null, Source = source; } - public Error(int status, string title, string detail, ErrorMeta meta = null, string source = null) + public Error(int status, string title, string detail, ErrorMeta meta = null, object source = null) { Status = status.ToString(); Title = title; @@ -45,13 +45,13 @@ public Error(int status, string title, string detail, ErrorMeta meta = null, str Meta = meta; Source = source; } - + [JsonProperty("title")] public string Title { get; set; } [JsonProperty("detail")] public string Detail { get; set; } - + [JsonProperty("status")] public string Status { get; set; } @@ -59,7 +59,7 @@ public Error(int status, string title, string detail, ErrorMeta meta = null, str public int StatusCode => int.Parse(Status); [JsonProperty("source")] - public string Source { get; set; } + public object Source { get; set; } [JsonProperty("meta")] public ErrorMeta Meta { get; set; } @@ -73,8 +73,8 @@ public class ErrorMeta [JsonProperty("stackTrace")] public string[] StackTrace { get; set; } - public static ErrorMeta FromException(Exception e) - => new ErrorMeta { + public static ErrorMeta FromException(Exception e) + => new ErrorMeta { StackTrace = e.Demystify().ToString().Split(new[] { "\n"}, int.MaxValue, StringSplitOptions.RemoveEmptyEntries) }; }