From 6ab8559876d930449c1c7288873d5ee69a9aaf78 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sat, 25 May 2019 17:09:48 +0800 Subject: [PATCH] feat(inspectorCanvas): wDBInspector, MaterialInspector->didMount add tryCatch --- .cz-config.js | 2 +- .../ui/MaterialInspector.re | 21 ++++++++++++------- .../wdb_inspector/ui/WDBInspector.re | 19 +++++++++++------ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.cz-config.js b/.cz-config.js index 660a45c0f..bca1cb139 100755 --- a/.cz-config.js +++ b/.cz-config.js @@ -15,7 +15,7 @@ module.exports = { ], scopes: [ - { name: "imgCanvas" }, + { name: "inspectorCanvas" }, { name: "asset-bundle" }, { name: "script" }, { name: "language" }, diff --git a/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/material_Inspector/ui/MaterialInspector.re b/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/material_Inspector/ui/MaterialInspector.re index 354a57ad1..c85a605a4 100755 --- a/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/material_Inspector/ui/MaterialInspector.re +++ b/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/material_Inspector/ui/MaterialInspector.re @@ -9,13 +9,20 @@ module Method = { let didMount = (type_, materialComponent) => { AssetTreeInspectorUtils.showInspectorCanvas(); - StateInspectorEngineService.unsafeGetState() - |> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas( - type_, - materialComponent, - (StateEditorService.getState(), StateEngineService.unsafeGetState()), - ) - |> StateLogicService.refreshInspectorEngineState; + Console.tryCatch( + () => + StateInspectorEngineService.unsafeGetState() + |> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas( + type_, + materialComponent, + ( + StateEditorService.getState(), + StateEngineService.unsafeGetState(), + ), + ) + |> StateLogicService.refreshInspectorEngineState, + e => Console.throwFatal(e) |> ignore, + ); }; let willUnmount = () => { diff --git a/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/wdb_inspector/ui/WDBInspector.re b/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/wdb_inspector/ui/WDBInspector.re index 357f5b6c4..f7a376b86 100644 --- a/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/wdb_inspector/ui/WDBInspector.re +++ b/src/core/composable_component/mainEditor/composable_component/inspector/composable_component/assetTree_Inspector/atom_component/wdb_inspector/ui/WDBInspector.re @@ -2,12 +2,19 @@ module Method = { let didMount = wdbGameObject => { AssetTreeInspectorUtils.showInspectorCanvas(); - StateInspectorEngineService.unsafeGetState() - |> WDBInspectorEngineUtils.createWDBIntoInspectorCanvas( - wdbGameObject, - (StateEditorService.getState(), StateEngineService.unsafeGetState()), - ) - |> StateLogicService.refreshInspectorEngineState; + Console.tryCatch( + () => + StateInspectorEngineService.unsafeGetState() + |> WDBInspectorEngineUtils.createWDBIntoInspectorCanvas( + wdbGameObject, + ( + StateEditorService.getState(), + StateEngineService.unsafeGetState(), + ), + ) + |> StateLogicService.refreshInspectorEngineState, + e => Console.throwFatal(e) |> ignore, + ); }; let willUnmount = () => {