tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ErrorCodeExtensions.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.ComponentModel;
3using System.Linq;
4
6{
10 public static class ErrorCodeExtensions
11 {
17 public static string? Describe(this ErrorCode errorCode)
18 {
19 var attributes = (IEnumerable<DescriptionAttribute>?)typeof(ErrorCode)
20 .GetField(errorCode.ToString())
21 ?.GetCustomAttributes(typeof(DescriptionAttribute), false);
22
23 return attributes?.FirstOrDefault()?.Description;
24 }
25 }
26}
Extension methods for the ErrorCode enum.
static ? string Describe(this ErrorCode errorCode)
Describe a given errorCode .
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12