bioserrormodule.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. \brief Possible Error codes for bios API.
  3. * This is the list of errors that can be returned from bios API.
  4. * Errors after UNKNOWN are extended errors that are not present in the native API.
  5. */
  6. enum EBiosError
  7. {
  8. //! 0 - No error. Can be returned from any call.
  9. OK,
  10. //! 1 - The operation was cancelled. See individual calls for details.
  11. CANCEL
  12. //! 2 - Atleast one of the input parameters is incorrect
  13. BAD_PARAMETER,
  14. //! 3 - The call could not find some data. See individual calls for details.
  15. NOT_FOUND,
  16. //! 4 - The call is not supported for the current platform. Can be returned from any call.
  17. NOT_IMPLEMENTED,
  18. //! 5 - [XB] The action cannot be performed because the user does not own the content.
  19. PURCHASE_REQUIRED,
  20. //! 6 - The action is not allowed. (restricted, not enough permission)
  21. NOT_ALLOWED,
  22. //! 7 - [XB] The user is banned from some action.
  23. BANNED,
  24. //! 8 - API usage error. For example, usage of objects whos native lifetime ended. Can be returned from any call.
  25. LOGICAL,
  26. //! 9 - Response was of unexpected format
  27. WRONG_RESPONSE_DATA,
  28. //! 10 - Server is no longer registered
  29. SERVER_HEARTBEAT_SERVER_NOT_FOUND,
  30. //! 11 - Server was already registered
  31. SERVER_REGISTER_ALREADY_EXISTS,
  32. //! 12 - Failed to open the request
  33. REQUEST_CREATE_FAIL_XHR,
  34. //! 13 - Failed to send the data
  35. REQUEST_SEND_FAIL,
  36. //! 14 - Failed to wait for the operation to end - only in a synchronous call
  37. REQUEST_WAIT_FAIL,
  38. //! 15 - Response was expected to be in JSON format, but it was not
  39. NON_JSON_RESPONSE,
  40. // RESERVED SPACE OF REDUNDANT ERRORS
  41. //! 21 - [PS] Mandatory update exist and is required.
  42. UPDATE_REQUIRED,
  43. //! 22 - [PS] Mandatory update exist and is ready to install.
  44. UPDATE_REQUIRED_AND_DOWNLOADED,
  45. //! 23 - Resource is unreachable or unavailable, can be 404 or no internet connection (etc.) - general communication error.
  46. COMUNICATION_ERROR,
  47. //! 24 - Any other error. Can be returned from any call.
  48. UNKNOWN,
  49. //! 25 - Extended error. Script not properly linked with engine. May be removed in future.
  50. BAD_SCRIPT,
  51. //! 26 - Connection has timed out.
  52. COMMUNICATION_TIMED_OUT,
  53. //! 27 - Connection was reset.
  54. COMMUNICATION_RESET,
  55. //! 28 - Connection was aborted.
  56. COMMUNICATION_ABORTED
  57. };
  58. class BIOSErrorModule : ErrorHandlerModuleScript
  59. {
  60. void BIOSErrorModule()
  61. {
  62. SetCategory(ErrorCategory.BIOSError);
  63. }
  64. override void InitOptionalVariables()
  65. {
  66. super.InitOptionalVariables();
  67. m_Header = "#STR_BIOS_BIOSError";
  68. }
  69. override void FillErrorDataMap()
  70. {
  71. super.FillErrorDataMap();
  72. InsertErrorProperties(EBiosError.OK); // Not an error, so no message
  73. InsertBIOSError(EBiosError.CANCEL , "#STR_BIOS_OperationCancelled");
  74. InsertBIOSError(EBiosError.BAD_PARAMETER , "#STR_BIOS_BadParameter");
  75. InsertBIOSError(EBiosError.NOT_FOUND , "#STR_BIOS_NotFound");
  76. InsertBIOSError(EBiosError.NOT_IMPLEMENTED , "#STR_BIOS_NotImplemented");
  77. InsertBIOSError(EBiosError.PURCHASE_REQUIRED , "#STR_BIOS_PurchaseRequired");
  78. InsertBIOSError(EBiosError.NOT_ALLOWED , "#STR_BIOS_ActionRestricted");
  79. InsertBIOSError(EBiosError.BANNED , "#STR_auth_publisher_ban");
  80. InsertBIOSError(EBiosError.LOGICAL , "#STR_BIOS_APILogicError");
  81. InsertBIOSError(EBiosError.WRONG_RESPONSE_DATA , "#STR_BIOS_UnexpectedFormat");
  82. InsertBIOSError(EBiosError.SERVER_HEARTBEAT_SERVER_NOT_FOUND , "#STR_BIOS_ServerNotRegistered");
  83. InsertBIOSError(EBiosError.SERVER_REGISTER_ALREADY_EXISTS , "#STR_BIOS_ServerAlreadyRegistered");
  84. InsertBIOSError(EBiosError.REQUEST_CREATE_FAIL_XHR , "#STR_BIOS_FailedToOpenRequest");
  85. InsertBIOSError(EBiosError.REQUEST_SEND_FAIL , "#STR_BIOS_FailedToSendData");
  86. InsertBIOSError(EBiosError.REQUEST_WAIT_FAIL , "#STR_BIOS_FailedToWaitOperationEnd");
  87. InsertBIOSError(EBiosError.NON_JSON_RESPONSE , "#STR_BIOS_UnexpectedFormat");
  88. InsertBIOSError(EBiosError.UPDATE_REQUIRED , "#STR_BIOS_UpdateRequired");
  89. InsertBIOSError(EBiosError.UPDATE_REQUIRED_AND_DOWNLOADED , "#STR_BIOS_UpdateRequiredAndDownloaded");
  90. InsertBIOSError(EBiosError.COMUNICATION_ERROR , "#STR_BIOS_CommunicationError");
  91. InsertBIOSError(EBiosError.UNKNOWN , "#server_browser_error_unknown");
  92. InsertBIOSError(EBiosError.BAD_SCRIPT , "#STR_BIOS_LinkageError");
  93. InsertBIOSError(EBiosError.COMMUNICATION_TIMED_OUT , "#STR_BIOS_CommTimeOutError");
  94. InsertBIOSError(EBiosError.COMMUNICATION_RESET , "#STR_BIOS_CommResetError");
  95. InsertBIOSError(EBiosError.COMMUNICATION_ABORTED , "#STR_BIOS_CommAbortError");
  96. }
  97. void InsertBIOSError(int code, string message)
  98. {
  99. #ifdef PLATFORM_CONSOLE
  100. InsertDialogueErrorProperties(code, message);
  101. #else
  102. InsertErrorProperties(code, message);
  103. #endif
  104. }
  105. }