fix(hippy-react-web): fix error handler

This commit is contained in:
corinli
2022-07-25 13:16:57 +08:00
committed by zoomchan-cxj
parent 145364b0e1
commit d289f3960b
2 changed files with 8 additions and 3 deletions
@@ -186,7 +186,7 @@ const Image: React.FC<ImageProps> = React.forwardRef((props: ImageProps, ref) =>
// delete unsupported props
delete restProps.tintColor;
delete restProps.ononProgress;
delete restProps.onProgress;
delete restProps.capInsets;
return (
+7 -2
View File
@@ -25,11 +25,16 @@ global.Hippy = {
// @ts-ignore
Device,
on: (eventName: string, handler: Function) => {
if (eventName === 'unhandleRejection') {
if (eventName.toUpperCase() === 'UNHANDLEDREJECTION') {
window.addEventListener('unhandledrejection', (event) => {
handler(event);
handler(event.reason, event.promise);
});
}
if (eventName.toUpperCase() === 'UNCAUGHTEXCEPTION') {
window.onerror = (message, source, lineno, colno, error) => {
handler(error, message, source, lineno, colno);
};
}
},
};
global.getTurboModule = () => {