|
1 | | -using Microsoft.AspNetCore.Http; |
2 | | -using Microsoft.AspNetCore.Mvc; |
3 | | -using System.Diagnostics; |
| 1 | +using System.Diagnostics; |
4 | 2 | using System.Net.Http.Headers; |
5 | 3 | using System.Net.Http.Json; |
6 | 4 | using System.Text; |
7 | 5 | using System.Text.Json; |
8 | 6 | using System.Web; |
| 7 | +using Microsoft.AspNetCore.Http; |
| 8 | +using Microsoft.AspNetCore.Mvc; |
9 | 9 |
|
10 | 10 | namespace NotionForCmdPalOAuthAPI.Authentication; |
11 | 11 |
|
@@ -83,22 +83,25 @@ public static async Task<IActionResult> HandleOAuthRedirection(Uri response) |
83 | 83 |
|
84 | 84 | return new ContentResult() |
85 | 85 | { |
86 | | - Content = string.Format(successMessage, responseUrl), |
| 86 | + Content = String.Format(successMessage, responseUrl), |
87 | 87 | ContentType = "text/html", |
88 | 88 | StatusCode = 200 |
89 | 89 | }; |
90 | 90 | } |
91 | 91 | catch (HttpRequestException ex) |
92 | 92 | { |
93 | 93 | Debug.WriteLine($"Request failed: {ex.Message}"); |
| 94 | + return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" }; |
94 | 95 | } |
95 | 96 | catch (JsonException ex) |
96 | 97 | { |
97 | 98 | Debug.WriteLine($"JSON parsing failed: {ex.Message}"); |
| 99 | + return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" }; |
98 | 100 | } |
99 | 101 | catch (Exception ex) |
100 | 102 | { |
101 | 103 | Debug.WriteLine($"Unexpected error: {ex.Message}"); |
| 104 | + return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" }; |
102 | 105 | } |
103 | 106 |
|
104 | 107 | return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later." }; |
|
0 commit comments