[backend/core] Improve logging
This commit is contained in:
parent
07f0223c99
commit
f724a55901
2 changed files with 5 additions and 4 deletions
|
@ -70,14 +70,15 @@ public class WebFingerService(
|
||||||
var split = query.Split('@');
|
var split = query.Split('@');
|
||||||
domain = split.Length switch
|
domain = split.Length switch
|
||||||
{
|
{
|
||||||
< 2 or > 3 => throw new GracefulException(HttpStatusCode.BadRequest, "Invalid query"),
|
< 2 or > 3 => throw new GracefulException(HttpStatusCode.BadRequest, $"Invalid query: {query}"),
|
||||||
2 => throw new GracefulException(HttpStatusCode.BadRequest, "Can't run WebFinger for local user"),
|
2 => throw new GracefulException(HttpStatusCode.BadRequest,
|
||||||
|
$"Can't run WebFinger for local user: {query}"),
|
||||||
_ => split[2]
|
_ => split[2]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new GracefulException(HttpStatusCode.BadRequest, "Invalid query");
|
throw new GracefulException(HttpStatusCode.BadRequest, $"Invalid query: {query}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (query, proto, domain);
|
return (query, proto, domain);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class UserService(
|
||||||
|
|
||||||
private (string Username, string? Host) AcctToTuple(string acct)
|
private (string Username, string? Host) AcctToTuple(string acct)
|
||||||
{
|
{
|
||||||
if (!acct.StartsWith("acct:")) throw new GracefulException(HttpStatusCode.BadRequest, "Invalid query");
|
if (!acct.StartsWith("acct:")) throw new GracefulException(HttpStatusCode.BadRequest, $"Invalid query: {acct}");
|
||||||
|
|
||||||
var split = acct[5..].Split('@');
|
var split = acct[5..].Split('@');
|
||||||
if (split.Length != 2)
|
if (split.Length != 2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue