diff --git a/PluralKit.Bot/Commands/ImportExportCommands.cs b/PluralKit.Bot/Commands/ImportExportCommands.cs index eb2690f1..4969da82 100644 --- a/PluralKit.Bot/Commands/ImportExportCommands.cs +++ b/PluralKit.Bot/Commands/ImportExportCommands.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Linq; using System.Net.Http; @@ -25,7 +26,17 @@ namespace PluralKit.Bot.Commands { using (var client = new HttpClient()) { - var response = await client.GetAsync(url); + HttpResponseMessage response; + try + { + response = await client.GetAsync(url); + } + catch (InvalidOperationException) + { + // Invalid URL throws this, we just error back out + throw Errors.InvalidImportFile; + } + if (!response.IsSuccessStatusCode) throw Errors.InvalidImportFile; var json = await response.Content.ReadAsStringAsync();