From 062787143f6df937472a2f3876979e9ad0f2722a Mon Sep 17 00:00:00 2001 From: YvesPa <166829028+YvesPa@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:12:37 +0100 Subject: [PATCH] Throw an lisible error if not config --- .../Services/Downloaders/DownloadStationDownloader.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/RdtClient.Service/Services/Downloaders/DownloadStationDownloader.cs b/server/RdtClient.Service/Services/Downloaders/DownloadStationDownloader.cs index 8441378..ad0821b 100644 --- a/server/RdtClient.Service/Services/Downloaders/DownloadStationDownloader.cs +++ b/server/RdtClient.Service/Services/Downloaders/DownloadStationDownloader.cs @@ -33,9 +33,16 @@ public class DownloadStationDownloader : IDownloader public static async Task Init(String? gid, String uri, String filePath, String downloadPath, String? category) { + if (Settings.Get.DownloadClient.DownloadStationUrl == null) + { + throw new("No URL specified for Synology download station"); + } + if (Settings.Get.DownloadClient.DownloadStationUsername == null || Settings.Get.DownloadClient.DownloadStationPassword == null) + { + throw new("No username/password specified for Synology download station"); + } var synologyClient = new SynologyClient(Settings.Get.DownloadClient.DownloadStationUrl); - if (Settings.Get.DownloadClient.DownloadStationUsername != null && Settings.Get.DownloadClient.DownloadStationPassword != null) - await synologyClient.LoginAsync(Settings.Get.DownloadClient.DownloadStationUsername, Settings.Get.DownloadClient.DownloadStationPassword); + await synologyClient.LoginAsync(Settings.Get.DownloadClient.DownloadStationUsername, Settings.Get.DownloadClient.DownloadStationPassword); String? remotePath = null; String? rootPath;