• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef WEB_ERRORS_H
17 #define WEB_ERRORS_H
18 
19 #include "errors.h"
20 
21 #include <string>
22 
23 namespace OHOS {
24 namespace ParamCheckErrorMsgTemplate {
25    extern const char* TYPE_ERROR;
26    extern const char* TYPE_ALL_STRING;
27    extern const char* TYPE_ALL_INT;
28    extern const char* PARAM_TYEPS_ERROR;
29    extern const char* PARAM_NUMBERS_ERROR_ONE;
30    extern const char* PARAM_NUMBERS_ERROR_TWO;
31    extern const char* PARAM_NUMBERS_ERROR_THREE;
32    extern const char* PARAM_NOT_NULL;
33    extern const char* PARAM_NOT_NULL_TWO;
34    extern const char* PARAM_TYPE_INVALID;
35    extern const char* PARAM_DETAIL_ERROR_MSG;
36 }
37 namespace NWebError {
38 constexpr ErrCode NWEB_ERROR = -1;
39 constexpr ErrCode NO_ERROR = 0;
40 
41 constexpr ErrCode PARAM_CHECK_ERROR = 401;
42 constexpr ErrCode CAPABILITY_NOT_SUPPORTED_ERROR = 801;
43 constexpr ErrCode INIT_ERROR = 17100001;
44 constexpr ErrCode INVALID_URL = 17100002;
45 constexpr ErrCode INVALID_RESOURCE = 17100003;
46 constexpr ErrCode FUNCTION_NOT_ENABLE = 17100004;
47 constexpr ErrCode INVALID_COOKIE_VALUE = 17100005;
48 constexpr ErrCode CAN_NOT_REGISTER_MESSAGE_EVENT = 17100006;
49 constexpr ErrCode CANNOT_DEL_JAVA_SCRIPT_PROXY = 17100008;
50 constexpr ErrCode CAN_NOT_POST_MESSAGE = 17100010;
51 constexpr ErrCode INVALID_ORIGIN = 17100011;
52 constexpr ErrCode NO_WEBSTORAGE_ORIGIN = 17100012;
53 constexpr ErrCode INVALID_SOCKET_NUMBER = 17100013;
54 constexpr ErrCode TYPE_NOT_MATCH_WITCH_VALUE = 17100014;
55 constexpr ErrCode NEW_OOM = 17100015;
56 constexpr ErrCode DOWNLOAD_NOT_PAUSED = 17100016;
57 constexpr ErrCode NO_VALID_CONTROLLER_FOR_DOWNLOAD = 17100017;
58 constexpr ErrCode NO_DOWNLOAD_DELEGATE_SET = 17100018;
59 constexpr ErrCode DOWNLOAD_NOT_START = 17100019;
60 constexpr ErrCode REGISTER_CUSTOM_SCHEME_FAILED = 17100020;
61 constexpr ErrCode RESOURCE_HANDLER_INVALID = 17100021;
62 constexpr ErrCode HTTP_BODY_STREAN_INIT_FAILED = 17100022;
63 constexpr ErrCode NOT_ALLOWED_PORT = 17100023;
64 constexpr ErrCode INVALID_NET_ERROR = 17100101;
65 
66 std::string GetErrMsgByErrCode(ErrCode code);
67 std::string FormatString(const char *errorMsgTemplate, ...);
68 }
69 }
70 #endif
71