From 58464d870871e178a4f05aceb846ea168a9de691 Mon Sep 17 00:00:00 2001 From: Tyrrrz Date: Wed, 24 Mar 2021 22:39:01 +0200 Subject: [PATCH] Improve error messages --- .../DiscordChatExporterException.cs | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs b/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs index de0434f..270e334 100644 --- a/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs +++ b/DiscordChatExporter.Core/Exceptions/DiscordChatExporterException.cs @@ -21,35 +21,25 @@ namespace DiscordChatExporter.Core.Exceptions var message = $@" Failed to perform an HTTP request. +[Request] {response.RequestMessage} +[Response] {response}"; return new DiscordChatExporterException(message.Trim(), true); } - internal static DiscordChatExporterException Unauthorized() - { - const string message = "Authentication token is invalid."; - return new DiscordChatExporterException(message); - } + internal static DiscordChatExporterException Unauthorized() => + new("Authentication token is invalid."); - internal static DiscordChatExporterException Forbidden() - { - const string message = "Access is forbidden."; - return new DiscordChatExporterException(message); - } + internal static DiscordChatExporterException Forbidden() => + new("Access is forbidden."); - internal static DiscordChatExporterException NotFound() - { - const string message = "Requested resource does not exist."; - return new DiscordChatExporterException(message); - } + internal static DiscordChatExporterException NotFound() => + new("Requested resource does not exist."); - internal static DiscordChatExporterException ChannelIsEmpty() - { - var message = $"No messages for the specified period."; - return new DiscordChatExporterException(message); - } + internal static DiscordChatExporterException ChannelIsEmpty() => + new("No messages found for the specified period."); } } \ No newline at end of file