Every failure the server answers with names its own error code
Each refusal and failure the client API sends now starts with a code no other failure uses, such as "[ERR0030006] That code is not valid.", so a screenshot or a report points at the exact place it came from. Nothing another program reads changes: ActivityPub, the Mastodon API's errors, sign-in tokens and the error kinds decePubClient branches on stay as they were. The house-rules checks move to 1.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
1 parent
f3fdeaf038
commit
c2f439d1e9
25 files changed
+268
-224
No files matched your search
@@ -53,17 +53,17 @@ namespace PrivaPub.Domain.Social
|
||||
{
|
||||
var follower = await OwnedAvatar(rootUserId, form.AvatarId, token);
|
||||
if (follower == default)
|
||||
return result.Invalidate(localizer["Avatar not found."], StatusCodes.Status404NotFound);
|
||||
return result.Invalidate(24001.ToCodedError(localizer["Avatar not found."]), StatusCodes.Status404NotFound);
|
||||
var following = await FollowAs(follower, form.Target, true, token: token);
|
||||
if (following == default)
|
||||
return result.Invalidate(localizer["Account not found."], StatusCodes.Status404NotFound);
|
||||
return result.Invalidate(24002.ToCodedError(localizer["Account not found."]), StatusCodes.Status404NotFound);
|
||||
result.Data = ToView(following);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, $"{nameof(FollowService)}.{nameof(Follow)}");
|
||||
return result.Invalidate(localizer["Something went wrong."], exception: ex);
|
||||
return result.Invalidate(24003.ToCodedError(localizer["Something went wrong."]), exception: ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,14 +74,14 @@ namespace PrivaPub.Domain.Social
|
||||
{
|
||||
var follower = await OwnedAvatar(rootUserId, form.AvatarId, token);
|
||||
if (follower == default)
|
||||
return result.Invalidate(localizer["Avatar not found."], StatusCodes.Status404NotFound);
|
||||
return result.Invalidate(24004.ToCodedError(localizer["Avatar not found."]), StatusCodes.Status404NotFound);
|
||||
await UnfollowAs(follower, form.Target, token);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, $"{nameof(FollowService)}.{nameof(Unfollow)}");
|
||||
return result.Invalidate(localizer["Something went wrong."], exception: ex);
|
||||
return result.Invalidate(24005.ToCodedError(localizer["Something went wrong."]), exception: ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace PrivaPub.Domain.Social
|
||||
var result = new WebResult();
|
||||
var follower = await OwnedAvatar(rootUserId, avatarId, token);
|
||||
if (follower == default)
|
||||
return result.Invalidate(localizer["Avatar not found."], StatusCodes.Status404NotFound);
|
||||
return result.Invalidate(24006.ToCodedError(localizer["Avatar not found."]), StatusCodes.Status404NotFound);
|
||||
result.Data = (await dbEntities.Followings.Match(f => f.AvatarId == follower.Id).Sort(f => f.ID, Order.Descending).ExecuteAsync(token))
|
||||
.Select(ToView).ToList();
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user