diff --git a/docs/Samples/Capture_bundle/NativeProject/entry/src/main/ets/entryability/EntryAbility.ets b/docs/Samples/Capture_bundle/NativeProject/entry/src/main/ets/entryability/EntryAbility.ets index fb4b7b1c989e0549ba541571eecf3c4e09121fa0..f18105b72a49e7af073130cabc869a9d47b45294 100644 --- a/docs/Samples/Capture_bundle/NativeProject/entry/src/main/ets/entryability/EntryAbility.ets +++ b/docs/Samples/Capture_bundle/NativeProject/entry/src/main/ets/entryability/EntryAbility.ets @@ -5,10 +5,28 @@ * LICENSE-MIT file in the root directory of this source tree. */ -import { RNAbility } from '@rnoh/react-native-openharmony'; +import { RNAbility, RNInstanceError, RNOHCoreContext } from '@rnoh/react-native-openharmony'; +import { Want } from '@kit.AbilityKit'; export default class EntryAbility extends RNAbility { getPagePath() { return 'pages/Index'; } + + override onCreate(want: Want): void { + super.onCreate(want); + AppStorage.get('RNOHCoreContext')!.subscribeToRNOHErrors((err) => { + console.log('HERE: error logged from entryability! ' + JSON.stringify(err)) + console.log('HERE: err.getMessage: ' + err.getMessage()) + console.log('HERE: err.getSuggestions:' + JSON.stringify(err.getSuggestions()), null, 2) + console.log('HERE: err.getExtraData: ' + JSON.stringify(err.getExtraData()), null, 2) + console.log('HERE: err.getStack: ' + JSON.stringify(err.getStack(), null, 2)) + //Not all errors are RNInstanceError's, so we need to check for that. + if (err instanceof RNInstanceError) { + console.log('HERE: err.getRNInstanceId: ' + err.getRNInstanceId()) + console.log('HERE: err.getRNInstanceName: ' + err.getRNInstanceName()) + } + }) + } + } \ No newline at end of file diff --git a/docs/Samples/Capture_bundle/README.md b/docs/Samples/Capture_bundle/README.md index 4a026b3fe00810d2cbf11682abe030456ffead66..f226ac9f60b6438408b70bf08ab1a6a94a0e3415 100644 --- a/docs/Samples/Capture_bundle/README.md +++ b/docs/Samples/Capture_bundle/README.md @@ -14,3 +14,17 @@ NativeProject -- 原生工程 3. 检查 `NativeProject`、`entry` 目录下是否生成 `oh-modules` 文件夹; 4. 用 DevEco Studio 打开 `NativeProject`,执行 **Sync and Refresh Project**; 5. 点击右上角的 **run** 启动项目。 + +# 预览 +运行界面 +![捕捉bundle异常运行界面图](../../zh-cn/figures/捕捉bundle运行界面图.png) + +日志输出 +- 基础错误信息 +- 错误消息 +- 错误建议 +- 额外数据 +- 堆栈数据 +- RNInstanceError类型的错误实例 + +![异常bundle日志信息输出图](../../zh-cn//figures/异常bundle错误信息输出.png) \ No newline at end of file diff --git "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201.png" "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201.png" index 51a3abdd1b273a84bc609087fdb85f99f2458291..1de10ffc0414dae2a07b8af07825fa1b91288e02 100644 Binary files "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201.png" and "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201.png" differ diff --git "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201\350\257\246\346\203\205.png" "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201\350\257\246\346\203\205.png" index a63f13de2c3cc4ca1be819c492b9b19e53ca8120..8da55307672559d45454098fcfc976efca776094 100644 Binary files "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201\350\257\246\346\203\205.png" and "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\345\225\206\345\223\201\350\257\246\346\203\205.png" differ diff --git "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\346\265\213\350\257\225\347\224\250\344\276\213.png" "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\346\265\213\350\257\225\347\224\250\344\276\213.png" index f4ecdfb038b208f1ee736bd409045458a8754b47..6678c6c7aa47f37374c0db24445b721b2c602be2 100644 Binary files "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\346\265\213\350\257\225\347\224\250\344\276\213.png" and "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\346\265\213\350\257\225\347\224\250\344\276\213.png" differ diff --git "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\351\246\226\351\241\265.png" "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\351\246\226\351\241\265.png" index 2acc1584237f5b912aebd1bd0a24a482d37d2279..54a930150591c9c22dd893153639940e2486af5b 100644 Binary files "a/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\351\246\226\351\241\265.png" and "b/docs/Samples/Sample/figures/\347\216\257\345\242\203\346\220\255\345\273\272-\351\246\226\351\241\265.png" differ diff --git "a/docs/zh-cn/figures/\345\274\202\345\270\270bundle\351\224\231\350\257\257\344\277\241\346\201\257\350\276\223\345\207\272.png" "b/docs/zh-cn/figures/\345\274\202\345\270\270bundle\351\224\231\350\257\257\344\277\241\346\201\257\350\276\223\345\207\272.png" new file mode 100644 index 0000000000000000000000000000000000000000..52b6cd2ff7af7a83c4e30e39bc665a5088f4efb6 Binary files /dev/null and "b/docs/zh-cn/figures/\345\274\202\345\270\270bundle\351\224\231\350\257\257\344\277\241\346\201\257\350\276\223\345\207\272.png" differ diff --git "a/docs/zh-cn/figures/\346\215\225\346\215\211bundle\350\277\220\350\241\214\347\225\214\351\235\242\345\233\276.png" "b/docs/zh-cn/figures/\346\215\225\346\215\211bundle\350\277\220\350\241\214\347\225\214\351\235\242\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..6e41890884c6c6bfb606ea1dc4a65dd09d7a6415 Binary files /dev/null and "b/docs/zh-cn/figures/\346\215\225\346\215\211bundle\350\277\220\350\241\214\347\225\214\351\235\242\345\233\276.png" differ