Skip to content

Commit ca30f6a

Browse files
author
pangyinqiang
committed
feat: 修改底层异常处理逻辑,将跳转错误页面改为弹出自定义弹窗
1 parent 154659c commit ca30f6a

File tree

6 files changed

+8
-103
lines changed

6 files changed

+8
-103
lines changed

harmony/exception_handler/src/main/cpp/ExceptionHandlerTurboModule.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
using namespace rnoh;
2828
using namespace facebook;
2929

30-
static jsi::Value _hostFunction_ExceptionHandlerTurboModuleSpecJSI_setHandlerforNativeException(
30+
static jsi::Value _hostFunction_ExceptionHandlerTurboModuleSpecJSI_setHandlerForNativeException(
3131
jsi::Runtime &rt,
3232
react::TurboModule &turboModule,
3333
const jsi::Value *args,
3434
size_t count)
3535
{
36-
return static_cast<ArkTSTurboModule &>(turboModule).call(rt, "setHandlerforNativeException", args, count);
36+
return static_cast<ArkTSTurboModule &>(turboModule).call(rt, "setHandlerForNativeException", args, count);
3737
}
3838

3939
ExceptionHandlerTurboModuleSpecJSI::ExceptionHandlerTurboModuleSpecJSI(
4040
const ArkTSTurboModule::Context ctx,
4141
const std::string name): ArkTSTurboModule(ctx, name)
4242
{
43-
methodMap_["setHandlerforNativeException"] =
44-
MethodMetadata{3, _hostFunction_ExceptionHandlerTurboModuleSpecJSI_setHandlerforNativeException};
43+
methodMap_["setHandlerForNativeException"] =
44+
MethodMetadata{3, _hostFunction_ExceptionHandlerTurboModuleSpecJSI_setHandlerForNativeException};
4545
}

harmony/exception_handler/src/main/ets/ExceptionHandlerPackage.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

harmony/exception_handler/src/main/ets/ExceptionHandlerTurboModule.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.
File renamed without changes.

src/NativeExceptionHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
2626
import { TurboModuleRegistry } from 'react-native';
2727

2828
interface ExceptionHandlerTurboModuleProtocol {
29-
setHandlerforNativeException(
29+
setHandlerForNativeException(
3030
handler: (errMsg: string) => void,
3131
forceAppQuit?: boolean,
3232
executeDefaultHandler?: boolean

src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export const setNativeExceptionHandler = (handler = noop, forceAppQuit = true, e
3535
return;
3636
}
3737
if (Platform.OS === "ios") {
38-
ExceptionHandlerTurboModule.setHandlerforNativeException(handler, executeDefaultHandler);
38+
ExceptionHandlerTurboModule.setHandlerForNativeException(handler, executeDefaultHandler);
3939
// @ts-ignore
4040
} else if (Platform.OS === "harmony") {
41-
ExceptionHandlerTurboModule.setHandlerforNativeException(handler, forceAppQuit, executeDefaultHandler);
41+
ExceptionHandlerTurboModule.setHandlerForNativeException(handler, forceAppQuit, executeDefaultHandler);
4242
} else {
43-
ExceptionHandlerTurboModule.setHandlerforNativeException(handler, forceAppQuit, executeDefaultHandler);
43+
ExceptionHandlerTurboModule.setHandlerForNativeException(handler, forceAppQuit, executeDefaultHandler);
4444
}
4545
};

0 commit comments

Comments
 (0)