mirror of
https://github.com/Ikatono/ComiServ.git
synced 2025-10-28 20:45:35 -05:00
API mostly working, starting to work on webapp
This commit is contained in:
34
Models/RequestError.cs
Normal file
34
Models/RequestError.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class RequestError
|
||||
{
|
||||
|
||||
public static RequestError InvalidHandle => new("Invalid handle");
|
||||
public static RequestError ComicNotFound => new("Comic not found");
|
||||
public static RequestError CoverNotFound => new("Cover not found");
|
||||
public static RequestError PageNotFound => new("Page not found");
|
||||
public static RequestError FileNotFound => new("File not found");
|
||||
public string[] Errors { get; }
|
||||
public RequestError(string ErrorMessage)
|
||||
{
|
||||
Errors = [ErrorMessage];
|
||||
}
|
||||
public RequestError(IEnumerable<string> ErrorMessages)
|
||||
{
|
||||
Errors = ErrorMessages.ToArray();
|
||||
}
|
||||
public RequestError And(RequestError other)
|
||||
{
|
||||
return new RequestError(Errors.Concat(other.Errors));
|
||||
}
|
||||
public RequestError And(string other)
|
||||
{
|
||||
return new RequestError(Errors.Append(other));
|
||||
}
|
||||
public RequestError And(IEnumerable<string> other)
|
||||
{
|
||||
return new RequestError(Errors.Concat(other))
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user