diff options
| author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-01 18:16:09 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-01 18:16:09 -0400 |
| commit | c8ad50dad1d706a1901798f9396f6becfea36c0e (patch) | |
| tree | 28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs | |
| parent | 451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff) | |
| parent | f78093bdb58d477b400cde3f19b70ffd6ddf833d (diff) | |
| download | SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2 SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip | |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs')
| -rw-r--r-- | src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs index 1be00be7..0e00f071 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs @@ -33,24 +33,24 @@ namespace StardewModdingAPI.Web.Framework.Clients.Pastebin try { // get from API - string content = await this.Client + string? content = await this.Client .GetAsync($"raw/{id}") .AsString(); // handle Pastebin errors if (string.IsNullOrWhiteSpace(content)) - return new PasteInfo { Error = "Received an empty response from Pastebin." }; + return new PasteInfo(null, "Received an empty response from Pastebin."); if (content.StartsWith("<!DOCTYPE")) - return new PasteInfo { Error = $"Received a captcha challenge from Pastebin. Please visit https://pastebin.com/{id} in a new window to solve it." }; - return new PasteInfo { Success = true, Content = content }; + return new PasteInfo(null, $"Received a captcha challenge from Pastebin. Please visit https://pastebin.com/{id} in a new window to solve it."); + return new PasteInfo(content, null); } catch (ApiException ex) when (ex.Status == HttpStatusCode.NotFound) { - return new PasteInfo { Error = "There's no log with that ID." }; + return new PasteInfo(null, "There's no log with that ID."); } catch (Exception ex) { - return new PasteInfo { Error = $"Pastebin error: {ex}" }; + return new PasteInfo(null, $"Pastebin error: {ex}"); } } |
