This commit is contained in:
Tyrrrz
2021-12-08 23:50:21 +02:00
parent 8e7baee8a5
commit 880f400e2c
148 changed files with 14241 additions and 14396 deletions

View File

@@ -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.");
}