1/* 2 * Copyright (c) 2022-2023 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 */ 34export default class ErrorObserver { 35 /** 36 * Will be called when the js runtime throws an exception which doesn't caught by user. 37 * 38 * @param { string } errMsg - the message and error stacktrace about the exception. 39 * @syscap SystemCapability.Ability.AbilityRuntime.Core 40 * @since 9 41 */ 42 /** 43 * Will be called when the js runtime throws an exception which doesn't caught by user. 44 * 45 * @param { string } errMsg - the message and error stacktrace about the exception. 46 * @syscap SystemCapability.Ability.AbilityRuntime.Core 47 * @atomicservice 48 * @since 11 49 */ 50 onUnhandledException(errMsg: string): void; 51 52 /** 53 * Will be called when the js runtime throws an exception which doesn't caught by user. 54 * 55 * @param { Error } errObject - the error object about the exception. 56 * @syscap SystemCapability.Ability.AbilityRuntime.Core 57 * @since 10 58 */ 59 /** 60 * Will be called when the js runtime throws an exception which doesn't caught by user. 61 * 62 * @param { Error } errObject - the error object about the exception. 63 * @syscap SystemCapability.Ability.AbilityRuntime.Core 64 * @atomicservice 65 * @since 11 66 */ 67 onException?(errObject: Error): void; 68} 69