summary refs log tree commit diff
path: root/MxApiExtensions/Auth.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MxApiExtensions/Auth.cs')
-rw-r--r--MxApiExtensions/Auth.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/MxApiExtensions/Auth.cs b/MxApiExtensions/Auth.cs

index 1f0cc80..cc60a99 100644 --- a/MxApiExtensions/Auth.cs +++ b/MxApiExtensions/Auth.cs
@@ -27,7 +27,7 @@ public class Auth { } if (token == null && fail) { - throw new MatrixException() { + throw new MatrixException { ErrorCode = "M_MISSING_TOKEN", Error = "Missing access token" }; @@ -40,7 +40,7 @@ public class Auth { var token = GetToken(fail); if (token == null) { if(fail) { - throw new MatrixException() { + throw new MatrixException { ErrorCode = "M_MISSING_TOKEN", Error = "Missing access token" }; @@ -60,14 +60,14 @@ public class Auth { hc.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var resp = hc.GetAsync($"{_config.Homeserver}/_matrix/client/v3/account/whoami").Result; if (!resp.IsSuccessStatusCode) { - throw new MatrixException() { + throw new MatrixException { ErrorCode = "M_UNKNOWN", Error = "[Rory&::MxSyncCache] Whoami request failed" }; } if (resp.Content is null) { - throw new MatrixException() { + throw new MatrixException { ErrorCode = "M_UNKNOWN", Error = "No content in response" }; @@ -75,7 +75,7 @@ public class Auth { var json = JsonDocument.Parse(resp.Content.ReadAsStream()).RootElement; var mxid = json.GetProperty("user_id").GetString()!; - _logger.LogInformation($"Got mxid {mxid} from token {token}"); + _logger.LogInformation("Got mxid {} from token {}", mxid, token); return mxid; }