tgstation-server 6.12.3
The /tg/station 13 server suite
Loading...
Searching...
No Matches
OperationResultExtensions.cs
Go to the documentation of this file.
1using System;
2using System.Linq;
3
4using StrawberryShake;
5
7{
11 public static class OperationResultExtensions
12 {
18 public static bool IsAuthenticationError(this IOperationResult operationResult)
19 {
20 ArgumentNullException.ThrowIfNull(operationResult);
21
22 return operationResult.Errors.Any(
23 error => error.Extensions?.TryGetValue(
24 "code",
25 out object? codeExtension) == true
26 && codeExtension is string codeExtensionString
27 && codeExtensionString == "AUTH_NOT_AUTHENTICATED");
28 }
29 }
30}
Extension methods for the IOperationResult interface.
static bool IsAuthenticationError(this IOperationResult operationResult)
Checks if a given operationResult errored out with authentication errors.