Uwaa/Pleroma/Models/PleromaException.cs
2024-12-25 23:08:58 +00:00

32 lines
No EOL
816 B
C#

namespace Uwaa.Pleroma;
public abstract class PleromaException : Exception
{
public override string ToString() => Message;
}
public class PleromaSimpleException : PleromaException
{
[JsonPropertyName("error")]
public string Text { get; set; } = null!;
public override string Message => Text;
}
public class PleromaAggregateException : PleromaException
{
[JsonPropertyName("errors")]
public PleromaInnerException[] Text { get; set; } = null!;
public override string Message => string.Join("\n", (object?[])Text);
public override Exception GetBaseException() => Text == null ? this : Text[0];
}
public class PleromaInnerException : PleromaException
{
[JsonPropertyName("detail")]
public string Text { get; set; } = null!;
public override string Message => Text;
}