Skip to content

Commit 8aee7f0

Browse files
committed
Working on OAuth
1 parent 4af9329 commit 8aee7f0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

NotionForCmdPalOAuthAPI/Authentication/OAuthClient.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Microsoft.AspNetCore.Http;
2-
using Microsoft.AspNetCore.Mvc;
3-
using System.Diagnostics;
1+
using System.Diagnostics;
42
using System.Net.Http.Headers;
53
using System.Net.Http.Json;
64
using System.Text;
75
using System.Text.Json;
86
using System.Web;
7+
using Microsoft.AspNetCore.Http;
8+
using Microsoft.AspNetCore.Mvc;
99

1010
namespace NotionForCmdPalOAuthAPI.Authentication;
1111

@@ -83,22 +83,25 @@ public static async Task<IActionResult> HandleOAuthRedirection(Uri response)
8383

8484
return new ContentResult()
8585
{
86-
Content = string.Format(successMessage, responseUrl),
86+
Content = String.Format(successMessage, responseUrl),
8787
ContentType = "text/html",
8888
StatusCode = 200
8989
};
9090
}
9191
catch (HttpRequestException ex)
9292
{
9393
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}" };
9495
}
9596
catch (JsonException ex)
9697
{
9798
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}" };
98100
}
99101
catch (Exception ex)
100102
{
101103
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}" };
102105
}
103106

104107
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later." };

0 commit comments

Comments
 (0)