steam_vent/
eresult.rs

1use num_enum::TryFromPrimitive;
2use std::convert::TryFrom;
3
4#[derive(TryFromPrimitive, Debug, Copy, Clone)]
5#[repr(i32)]
6#[non_exhaustive]
7pub enum EResult {
8    Invalid = 0,
9    OK = 1,
10    Fail = 2,
11    NoConnection = 3,
12    InvalidPassword = 5,
13    LoggedInElsewhere = 6,
14    InvalidProtocolVer = 7,
15    InvalidParam = 8,
16    FileNotFound = 9,
17    Busy = 10,
18    InvalidState = 11,
19    InvalidName = 12,
20    InvalidEmail = 13,
21    DuplicateName = 14,
22    AccessDenied = 15,
23    Timeout = 16,
24    Banned = 17,
25    AccountNotFound = 18,
26    InvalidSteamID = 19,
27    ServiceUnavailable = 20,
28    NotLoggedOn = 21,
29    Pending = 22,
30    EncryptionFailure = 23,
31    InsufficientPrivilege = 24,
32    LimitExceeded = 25,
33    Revoked = 26,
34    Expired = 27,
35    AlreadyRedeemed = 28,
36    DuplicateRequest = 29,
37    AlreadyOwned = 30,
38    IPNotFound = 31,
39    PersistFailed = 32,
40    LockingFailed = 33,
41    LogonSessionReplaced = 34,
42    ConnectFailed = 35,
43    HandshakeFailed = 36,
44    IOFailure = 37,
45    RemoteDisconnect = 38,
46    ShoppingCartNotFound = 39,
47    Blocked = 40,
48    Ignored = 41,
49    NoMatch = 42,
50    AccountDisabled = 43,
51    ServiceReadOnly = 44,
52    AccountNotFeatured = 45,
53    AdministratorOK = 46,
54    ContentVersion = 47,
55    TryAnotherCM = 48,
56    PasswordRequiredToKickSession = 49,
57    AlreadyLoggedInElsewhere = 50,
58    Suspended = 51,
59    Cancelled = 52,
60    DataCorruption = 53,
61    DiskFull = 54,
62    RemoteCallFailed = 55,
63    // PasswordNotSet = 56, // removed renamed to PasswordUnset
64    PasswordUnset = 56,
65    ExternalAccountUnlinked = 57,
66    PSNTicketInvalid = 58,
67    ExternalAccountAlreadyLinked = 59,
68    RemoteFileConflict = 60,
69    IllegalPassword = 61,
70    SameAsPreviousValue = 62,
71    AccountLogonDenied = 63,
72    CannotUseOldPassword = 64,
73    InvalidLoginAuthCode = 65,
74    // AccountLogonDeniedNoMailSent = 66, // removed renamed to AccountLogonDeniedNoMail
75    AccountLogonDeniedNoMail = 66,
76    HardwareNotCapableOfIPT = 67,
77    IPTInitError = 68,
78    ParentalControlRestricted = 69,
79    FacebookQueryError = 70,
80    ExpiredLoginAuthCode = 71,
81    IPLoginRestrictionFailed = 72,
82    // AccountLocked = 73, // removed renamed to AccountLockedDown
83    AccountLockedDown = 73,
84    AccountLogonDeniedVerifiedEmailRequired = 74,
85    NoMatchingURL = 75,
86    BadResponse = 76,
87    RequirePasswordReEntry = 77,
88    ValueOutOfRange = 78,
89    UnexpectedError = 79,
90    Disabled = 80,
91    InvalidCEGSubmission = 81,
92    RestrictedDevice = 82,
93    RegionLocked = 83,
94    RateLimitExceeded = 84,
95    // AccountLogonDeniedNeedTwoFactorCode = 85, // removed renamed to AccountLoginDeniedNeedTwoFactor
96    AccountLoginDeniedNeedTwoFactor = 85,
97    // ItemOrEntryHasBeenDeleted = 86, // removed renamed to ItemDeleted
98    ItemDeleted = 86,
99    AccountLoginDeniedThrottle = 87,
100    TwoFactorCodeMismatch = 88,
101    TwoFactorActivationCodeMismatch = 89,
102    // AccountAssociatedToMultiplePlayers = 90, // removed renamed to AccountAssociatedToMultiplePartners
103    AccountAssociatedToMultiplePartners = 90,
104    NotModified = 91,
105    // NoMobileDeviceAvailable = 92, // removed renamed to NoMobileDevice
106    NoMobileDevice = 92,
107    // TimeIsOutOfSync = 93, // removed renamed to TimeNotSynced
108    TimeNotSynced = 93,
109    SMSCodeFailed = 94,
110    // TooManyAccountsAccessThisResource = 95, // removed renamed to AccountLimitExceeded
111    AccountLimitExceeded = 95,
112    AccountActivityLimitExceeded = 96,
113    PhoneActivityLimitExceeded = 97,
114    RefundToWallet = 98,
115    EmailSendFailure = 99,
116    NotSettled = 100,
117    NeedCaptcha = 101,
118    GSLTDenied = 102,
119    GSOwnerDenied = 103,
120    InvalidItemType = 104,
121    IPBanned = 105,
122    GSLTExpired = 106,
123    InsufficientFunds = 107,
124    TooManyPending = 108,
125    NoSiteLicensesFound = 109,
126    WGNetworkSendExceeded = 110,
127    AccountNotFriends = 111,
128    LimitedUserAccount = 112,
129    CantRemoveItem = 113,
130    AccountHasBeenDeleted = 114,
131    AccountHasAnExistingUserCancelledLicense = 115,
132    DeniedDueToCommunityCooldown = 116,
133    NoLauncherSpecified = 117,
134    MustAgreeToSSA = 118,
135    ClientNoLongerSupported = 119,
136}
137
138impl EResult {
139    pub fn from_result(result: i32) -> Result<(), EResult> {
140        let result = EResult::try_from(result).unwrap_or(EResult::Invalid);
141        match result {
142            EResult::OK => Ok(()),
143            err => Err(err),
144        }
145    }
146}