mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-10 20:02:31 +00:00
C#10ify
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace DiscordChatExporter.Core.Exceptions
|
||||
namespace DiscordChatExporter.Core.Exceptions;
|
||||
|
||||
public partial class DiscordChatExporterException : Exception
|
||||
{
|
||||
public partial class DiscordChatExporterException : Exception
|
||||
{
|
||||
public bool IsFatal { get; }
|
||||
public bool IsFatal { get; }
|
||||
|
||||
public DiscordChatExporterException(string message, bool isFatal = false)
|
||||
: base(message)
|
||||
{
|
||||
IsFatal = isFatal;
|
||||
}
|
||||
public DiscordChatExporterException(string message, bool isFatal = false)
|
||||
: base(message)
|
||||
{
|
||||
IsFatal = isFatal;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class DiscordChatExporterException
|
||||
public partial class DiscordChatExporterException
|
||||
{
|
||||
internal static DiscordChatExporterException FailedHttpRequest(HttpResponseMessage response)
|
||||
{
|
||||
internal static DiscordChatExporterException FailedHttpRequest(HttpResponseMessage response)
|
||||
{
|
||||
var message = $@"
|
||||
var message = $@"
|
||||
Failed to perform an HTTP request.
|
||||
|
||||
[Request]
|
||||
@@ -27,19 +27,18 @@ Failed to perform an HTTP request.
|
||||
[Response]
|
||||
{response}";
|
||||
|
||||
return new DiscordChatExporterException(message.Trim(), true);
|
||||
}
|
||||
|
||||
internal static DiscordChatExporterException Unauthorized() =>
|
||||
new("Authentication token is invalid.", true);
|
||||
|
||||
internal static DiscordChatExporterException Forbidden() =>
|
||||
new("Access is forbidden.");
|
||||
|
||||
internal static DiscordChatExporterException NotFound(string resourceId) =>
|
||||
new($"Requested resource ({resourceId}) does not exist.");
|
||||
|
||||
internal static DiscordChatExporterException ChannelIsEmpty() =>
|
||||
new("No messages found for the specified period.");
|
||||
return new DiscordChatExporterException(message.Trim(), true);
|
||||
}
|
||||
|
||||
internal static DiscordChatExporterException Unauthorized() =>
|
||||
new("Authentication token is invalid.", true);
|
||||
|
||||
internal static DiscordChatExporterException Forbidden() =>
|
||||
new("Access is forbidden.");
|
||||
|
||||
internal static DiscordChatExporterException NotFound(string resourceId) =>
|
||||
new($"Requested resource ({resourceId}) does not exist.");
|
||||
|
||||
internal static DiscordChatExporterException ChannelIsEmpty() =>
|
||||
new("No messages found for the specified period.");
|
||||
}
|
||||
Reference in New Issue
Block a user