ErrorUtil.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. namespace Top.Api.Security
  3. {
  4. public class ErrorUtil
  5. {
  6. private static readonly string[] InvalidSessionCodes = { "26", "27", "53" };
  7. private static readonly string[] InvalidSubUserCodes = { "12" };
  8. private static readonly string InvalidSessionkey = "invalid-sessionkey";
  9. public static bool IsInvalidSession(SecretException secretException) {
  10. foreach (string code in InvalidSessionCodes)
  11. {
  12. if (code.Equals(secretException.ErrorCode) && InvalidSessionkey.Equals(secretException.SubErrorCode)) {
  13. return true;
  14. }
  15. }
  16. return false;
  17. }
  18. public static bool IsInvalidSubCode(SecretException secretException) {
  19. foreach (string code in InvalidSubUserCodes)
  20. {
  21. if (code.Equals(secretException.ErrorCode)) {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. }
  28. }