WXSDKError.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. #import <Foundation/Foundation.h>
  20. #import "WXSDKInstance.h"
  21. #define WX_ERROR_GROUP_NATIVE @"NATIVE"
  22. #define WX_ERROR_GROUP_JS @"JS"
  23. #define WX_ERROR_GROUP_NET @"NET"
  24. #define WX_ERROR_TYPE_NATIVE @"NATIVE_ERROR"
  25. #define WX_ERROR_TYPE_JS @"JS_ERROR"
  26. #define WX_ERROR_TYPE_DEGRADE @"DEGRAD_ERROR"
  27. #define WX_ERROR_TYPE_RENDER @"RENDER_ERROR"
  28. #define WX_ERROR_TYPE_DOWNLOAD @"DOWN_LOAD_ERROR"
  29. typedef NS_ENUM(int, WXSDKErrCode)
  30. {
  31. WX_ERR_JSFRAMEWORK_START = -1001,
  32. WX_ERR_JSFRAMEWORK_LOAD = -1002,
  33. WX_ERR_JSFRAMEWORK_EXECUTE = -1003,
  34. WX_ERR_JSFRAMEWORK_END = -1099,
  35. WX_ERR_JSBRIDGE_START = -2001,
  36. WX_ERR_JSFUNC_PARAM = -2009,
  37. WX_ERR_INVOKE_NATIVE = -2012,
  38. WX_ERR_JS_EXECUTE = -2013,
  39. WX_ERR_JSBRIDGE_END = -2099,
  40. WX_ERR_RENDER_START = -2100,
  41. WX_ERR_RENDER_CREATEBODY = -2100,
  42. WX_ERR_RENDER_UPDATTR = -2101,
  43. WX_ERR_RENDER_UPDSTYLE = -2102,
  44. WX_ERR_RENDER_ADDELEMENT = -2103,
  45. WX_ERR_RENDER_REMOVEELEMENT = -2104,
  46. WX_ERR_RENDER_MOVEELEMENT = -2105,
  47. WX_ERR_RENDER_ADDEVENT = -2106,
  48. WX_ERR_RENDER_REMOVEEVENT = -2107,
  49. WX_ERR_RENDER_SCROLLTOELEMENT = -2110,
  50. WX_ERR_RENDER_TWICE = -2111,
  51. WX_ERR_RENDER_END = -2199,
  52. WX_ERR_DOWNLOAD_START = -2201,
  53. WX_ERR_JSBUNDLE_DOWNLOAD = -2202,
  54. WX_ERR_JSBUNDLE_STRING_CONVERT = -2203,
  55. WX_ERR_NOT_CONNECTED_TO_INTERNET = -2205,
  56. WX_ERR_CANCEL = -2204,
  57. WX_ERR_DOWNLOAD_END = -2299,
  58. WX_KEY_EXCEPTION_SDK_INIT = -9000,
  59. WX_KEY_EXCEPTION_INVOKE = -9100,
  60. WX_KEY_EXCEPTION_JS_DOWNLOAD =-9200,
  61. WX_KEY_EXCEPTION_DOM = -9300,
  62. WX_KEY_EXCEPTION_WXBRIDGE=-9400,
  63. WX_KEY_EXCEPTION_DEGRADE = -9500,
  64. WX_KEY_EXCEPTION_DEGRADE_CHECK_CONTENT_LENGTH_FAILED = -9501,
  65. WX_KEY_EXCEPTION_DEGRADE_BUNDLE_CONTENTTYPE_ERROR = -9502,
  66. WX_KEY_EXCEPTION_DEGRADE_OTHER_CAUSE = -9503,
  67. WX_KEY_EXCEPTION_DEGRADE_NET_CODE_CAUSE = -9504,
  68. WX_KEY_EXCEPTION_ABILITY_DOWN = -9600,
  69. WX_KEY_EXCEPTION_ABILITY_DOWN_IMAGE = -9601,
  70. WX_KEY_EXCEPTION_ABILITY_DOWN_TOH5 = -9602,
  71. WX_KEY_EXCEPTION_ABILITY_DOWN_ = -9603,
  72. WX_KEY_EXCEPTION_EMPTY_SCREEN_JS = -9700,
  73. WX_KEY_EXCEPTION_EMPTY_SCREEN_NATIVE = -9701
  74. };
  75. typedef NS_ENUM (NSInteger,WXSDKErrorType)
  76. {
  77. WX_JS_ERROR,
  78. WX_NATIVE_ERROR,
  79. WX_RENDER_ERROR,
  80. WX_DEGRADE_ERROR,
  81. WX_DOWN_LOAD_ERROR
  82. };
  83. typedef NS_ENUM (NSInteger,WXSDKErrorGroup){
  84. WX_JS,
  85. WX_NATIVE,
  86. WX_NET
  87. };
  88. @interface WXSDKErrCodeUtil :NSObject
  89. + (WXSDKErrorType) getErrorTypeByCode:(WXSDKErrCode) code;
  90. + (WXSDKErrorGroup) getErrorGroupByCode:(WXSDKErrCode) code;
  91. + (NSString *) convertGroupToStringName:(WXSDKErrorGroup) group;
  92. + (NSString *) convertTypeToStringName:(WXSDKErrorType)type;
  93. @end