handle exception in sharedInbox

This commit is contained in:
Nicolas Constant 2022-02-09 01:54:35 -05:00
parent d0dd317723
commit 7007b6309a
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688
4 changed files with 23 additions and 19 deletions

View file

@ -46,7 +46,7 @@ namespace BirdsiteLive.Domain
var result = await httpClient.GetAsync(objectId); var result = await httpClient.GetAsync(objectId);
if (result.StatusCode == HttpStatusCode.Gone) if (result.StatusCode == HttpStatusCode.Gone)
throw new UserIsGoneException(); throw new FollowerIsGoneException();
result.EnsureSuccessStatusCode(); result.EnsureSuccessStatusCode();

View file

@ -2,7 +2,7 @@
namespace BirdsiteLive.Domain namespace BirdsiteLive.Domain
{ {
public class UserIsGoneException : Exception public class FollowerIsGoneException : Exception
{ {
} }
} }

View file

@ -30,6 +30,8 @@ namespace BirdsiteLive.Controllers
[Route("/inbox")] [Route("/inbox")]
[HttpPost] [HttpPost]
public async Task<IActionResult> Inbox() public async Task<IActionResult> Inbox()
{
try
{ {
var r = Request; var r = Request;
using (var reader = new StreamReader(Request.Body)) using (var reader = new StreamReader(Request.Body))
@ -53,6 +55,8 @@ namespace BirdsiteLive.Controllers
} }
} }
} }
}
catch (FollowerIsGoneException) { } //TODO: check if user in DB
return Accepted(); return Accepted();
} }

View file

@ -214,7 +214,7 @@ namespace BirdsiteLive.Controllers
} }
} }
} }
catch (UserIsGoneException) catch (FollowerIsGoneException) //TODO: check if user in DB
{ {
return Accepted(); return Accepted();
} }