Improve error messages

This commit is contained in:
Tyrrrz 2021-03-24 22:39:01 +02:00
parent 026927265a
commit 58464d8708

View file

@ -21,35 +21,25 @@ namespace DiscordChatExporter.Core.Exceptions
var message = $@" var message = $@"
Failed to perform an HTTP request. Failed to perform an HTTP request.
[Request]
{response.RequestMessage} {response.RequestMessage}
[Response]
{response}"; {response}";
return new DiscordChatExporterException(message.Trim(), true); return new DiscordChatExporterException(message.Trim(), true);
} }
internal static DiscordChatExporterException Unauthorized() internal static DiscordChatExporterException Unauthorized() =>
{ new("Authentication token is invalid.");
const string message = "Authentication token is invalid.";
return new DiscordChatExporterException(message);
}
internal static DiscordChatExporterException Forbidden() internal static DiscordChatExporterException Forbidden() =>
{ new("Access is forbidden.");
const string message = "Access is forbidden.";
return new DiscordChatExporterException(message);
}
internal static DiscordChatExporterException NotFound() internal static DiscordChatExporterException NotFound() =>
{ new("Requested resource does not exist.");
const string message = "Requested resource does not exist.";
return new DiscordChatExporterException(message);
}
internal static DiscordChatExporterException ChannelIsEmpty() internal static DiscordChatExporterException ChannelIsEmpty() =>
{ new("No messages found for the specified period.");
var message = $"No messages for the specified period.";
return new DiscordChatExporterException(message);
}
} }
} }