[backend/middleware] Fix error responses always returning 500
This commit is contained in:
parent
97de0b8410
commit
f6d2fd329d
1 changed files with 7 additions and 2 deletions
|
@ -5,8 +5,13 @@ using JI = System.Text.Json.Serialization.JsonIgnoreAttribute;
|
||||||
namespace Iceshrimp.Shared.Schemas.Web;
|
namespace Iceshrimp.Shared.Schemas.Web;
|
||||||
|
|
||||||
[XmlRoot("Error")]
|
[XmlRoot("Error")]
|
||||||
public class ErrorResponse(Exception exception)
|
public class ErrorResponse()
|
||||||
{
|
{
|
||||||
|
public ErrorResponse(Exception exception) : this()
|
||||||
|
{
|
||||||
|
Exception = exception;
|
||||||
|
}
|
||||||
|
|
||||||
[XmlElement("Status")] public required int StatusCode { get; set; }
|
[XmlElement("Status")] public required int StatusCode { get; set; }
|
||||||
[XmlElement("Error")] public required string Error { get; set; }
|
[XmlElement("Error")] public required string Error { get; set; }
|
||||||
|
|
||||||
|
@ -38,7 +43,7 @@ public class ErrorResponse(Exception exception)
|
||||||
|
|
||||||
[XmlElement("RequestId")] public required string RequestId { get; set; }
|
[XmlElement("RequestId")] public required string RequestId { get; set; }
|
||||||
|
|
||||||
[JI] [XmlIgnore] public Exception Exception => exception;
|
[JI] [XmlIgnore] public Exception Exception = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XmlValidationError
|
public class XmlValidationError
|
||||||
|
|
Loading…
Add table
Reference in a new issue