1/* 2 * Copyright (c) 2022-2025 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/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21/** 22 * The observer will be called by system when an error occurs. 23 * 24 * @syscap SystemCapability.Ability.AbilityRuntime.Core 25 * @since 9 26 */ 27/** 28 * The observer will be called by system when an error occurs. 29 * 30 * @syscap SystemCapability.Ability.AbilityRuntime.Core 31 * @atomicservice 32 * @since 11 33 */ 34/** 35 * The observer will be called by system when an error occurs. 36 * 37 * @syscap SystemCapability.Ability.AbilityRuntime.Core 38 * @crossplatform 39 * @atomicservice 40 * @since 19 41 */ 42export default class ErrorObserver { 43 /** 44 * Will be called when the js runtime throws an exception which doesn't caught by user. 45 * 46 * @param { string } errMsg - the message and error stacktrace about the exception. 47 * @syscap SystemCapability.Ability.AbilityRuntime.Core 48 * @since 9 49 */ 50 /** 51 * Will be called when the js runtime throws an exception which doesn't caught by user. 52 * 53 * @param { string } errMsg - the message and error stacktrace about the exception. 54 * @syscap SystemCapability.Ability.AbilityRuntime.Core 55 * @atomicservice 56 * @since 11 57 */ 58 /** 59 * Will be called when the js runtime throws an exception which doesn't caught by user. 60 * 61 * @param { string } errMsg - the message and error stacktrace about the exception. 62 * @syscap SystemCapability.Ability.AbilityRuntime.Core 63 * @crossplatform 64 * @atomicservice 65 * @since 19 66 */ 67 onUnhandledException(errMsg: string): void; 68 69 /** 70 * Will be called when the js runtime throws an exception which doesn't caught by user. 71 * 72 * @param { Error } errObject - the error object about the exception. 73 * @syscap SystemCapability.Ability.AbilityRuntime.Core 74 * @since 10 75 */ 76 /** 77 * Will be called when the js runtime throws an exception which doesn't caught by user. 78 * 79 * @param { Error } errObject - the error object about the exception. 80 * @syscap SystemCapability.Ability.AbilityRuntime.Core 81 * @atomicservice 82 * @since 11 83 */ 84 /** 85 * Will be called when the js runtime throws an exception which doesn't caught by user. 86 * 87 * @param { Error } errObject - the error object about the exception. 88 * @syscap SystemCapability.Ability.AbilityRuntime.Core 89 * @crossplatform 90 * @atomicservice 91 * @since 19 92 */ 93 onException?(errObject: Error): void; 94} 95