• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * The observer will be called by system when an error occurs.
18 *
19 * @syscap SystemCapability.Ability.AbilityRuntime.Core
20 * @since 9
21 */
22/**
23 * The observer will be called by system when an error occurs.
24 *
25 * @syscap SystemCapability.Ability.AbilityRuntime.Core
26 * @atomicservice
27 * @since 11
28 */
29export default class ErrorObserver {
30  /**
31   * Will be called when the js runtime throws an exception which doesn't caught by user.
32   *
33   * @param { string } errMsg - the message and error stacktrace about the exception.
34   * @syscap SystemCapability.Ability.AbilityRuntime.Core
35   * @since 9
36   */
37  /**
38   * Will be called when the js runtime throws an exception which doesn't caught by user.
39   *
40   * @param { string } errMsg - the message and error stacktrace about the exception.
41   * @syscap SystemCapability.Ability.AbilityRuntime.Core
42   * @atomicservice
43   * @since 11
44   */
45  onUnhandledException(errMsg: string): void;
46
47  /**
48   * Will be called when the js runtime throws an exception which doesn't caught by user.
49   *
50   * @param { Error } errObject - the error object about the exception.
51   * @syscap SystemCapability.Ability.AbilityRuntime.Core
52   * @since 10
53   */
54  /**
55   * Will be called when the js runtime throws an exception which doesn't caught by user.
56   *
57   * @param { Error } errObject - the error object about the exception.
58   * @syscap SystemCapability.Ability.AbilityRuntime.Core
59   * @atomicservice
60   * @since 11
61   */
62  onException?(errObject: Error): void;
63}
64