1 /* 2 * Copyright (C) 2021-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 TASK_FAULT_H 17 #define TASK_FAULT_H 18 19 namespace OHOS::Request::Download { 20 class TaskFault { 21 public: 22 static TaskFault &GetInstance(); 23 void ReportServiceStartFault(int error) const; 24 void ReportTaskFault(int error) const; 25 private: 26 TaskFault() = default; 27 ~TaskFault() = default; 28 TaskFault(const TaskFault &) = delete; 29 TaskFault(TaskFault &&) = delete; 30 TaskFault &operator=(const TaskFault &) = delete; 31 TaskFault &operator=(TaskFault &&) = delete; 32 33 static constexpr const char *REQUEST_SERVICE_START_FAULT = "REQUEST_SERVICE_START_FAULT"; 34 static constexpr const char *REQUEST_TASK_FAULT = "REQUEST_TASK_FAULT"; 35 static constexpr const char *TASKS_TYPE = "TASKS_TYPE"; 36 static constexpr const char *DOWNLOAD = "DOWNLOAD"; 37 static constexpr const char *TOTAL_FILE_NUM = "TOTAL_FILE_NUM"; 38 static constexpr const char *FAIL_FILE_NUM = "FAIL_FILE_NUM"; 39 static constexpr const char *SUCCESS_FILE_NUM = "SUCCESS_FILE_NUM"; 40 static constexpr const char *ERROR_INFO = "ERROR_INFO"; 41 }; 42 } 43 #endif // TASK_FAULT_H