Skip to content

Commit

Permalink
perf(editor): if script error, not download eventData, and still cont…
Browse files Browse the repository at this point in the history
…inue loop
  • Loading branch information
yyc-git committed Mar 9, 2024
1 parent bc78aa1 commit d4b5363
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 24 deletions.
2 changes: 1 addition & 1 deletion contributes/meta3d-action-run/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-action-run",
"version": "1.3.4",
"version": "1.3.5",
"publisher": "meta3d",
"displayName": "meta3d-action-run",
"repoLink": "",
Expand Down
11 changes: 9 additions & 2 deletions doc/jiehuo.org
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,26 @@ TODO packages:



* TODO 优化: 错误 打印
* DONE 优化: 错误 打印

use error instead of throw
# use error instead of throw



TODO RunElementVisual:
if error, show error message and continue(loop)


TODO fix:
continue from event data: recursive



TODO e,c,p:
editor-whole
gameview c

run



Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-editor-webgl1-three-whole",
"version": "1.3.3",
"version": "1.3.4",
"publisher": "meta3d",
"protocol": {
"name": "meta3d-editor-whole-protocol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ let _exportEventDataForDebug = (meta3dState: meta3dState, eventSourcingService:
)
}

let _handleError = (api: api, meta3dState: meta3dState) => {
let _handleError = (api: api, e: Error, meta3dState: meta3dState) => {
if ((e as any).errorType === "script") {
return
}

let eventService = getExn(api.getPackageService<eventService>(meta3dState, "meta3d-event-protocol"))

_exportEventDataForDebug(
Expand Down Expand Up @@ -306,7 +310,7 @@ let _updateForVisual = (meta3dState, api: api, { clearColor, time, skinName }) =
).then(meta3dState => {
return render(meta3dState, ["meta3d-ui-protocol", "meta3d-imgui-renderer-protocol"], time)
}).catch(e => {
_handleError(api, meta3dState)
_handleError(api, e, meta3dState)
throw e
})
}
Expand Down Expand Up @@ -334,7 +338,7 @@ let _updateForVisualRun = (meta3dState, api: api, { clearColor, time, skinName }
}).then(meta3dState => {
return _loopEngine(meta3dState, api)
}).catch(e => {
_handleError(api, meta3dState)
_handleError(api, e, meta3dState)
throw e
})
}
Expand Down Expand Up @@ -460,7 +464,7 @@ export let getExtensionService: getExtensionServiceMeta3D<

return _initBackend(api, meta3dState, env)
}).catch(e => {
_handleError(api, meta3dState)
_handleError(api, e, meta3dState)
throw e
})
},
Expand Down Expand Up @@ -502,7 +506,7 @@ export let getExtensionService: getExtensionServiceMeta3D<

return _initBackend(api, meta3dState, env)
}).catch(e => {
_handleError(api, meta3dState)
_handleError(api, e, meta3dState)
throw e
}).then((meta3dState: meta3dState) => {
_loop(api, meta3dState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meta3d-pipeline-webgl1-three-gameviewrender",
"version": "1.3.4",
"version": "1.3.6",
"publisher": "meta3d",
"protocol": {
"name": "meta3d-pipeline-webgl1-three-gameviewrender-protocol"
Expand All @@ -20,12 +20,12 @@
"meta3d-editor-whole-protocol": "^1.3.0",
"meta3d-engine-scene-protocol": "^1.3.0",
"meta3d-event-protocol": "^1.3.0",
"meta3d-interact-protocol": "^1.3.0",
"meta3d-pipeline-webgl1-three-gameviewrender-protocol": "^1.3.0",
"meta3d-three-protocol": "^1.3.0",
"meta3d-type": "^1.3.0",
"meta3d-ui-control-game-view-protocol": "^1.3.0",
"meta3d-ui-protocol": "^1.3.0",
"meta3d-interact-protocol": "^1.3.0"
"meta3d-ui-protocol": "^1.3.0"
},
"devDependencies": {
"clean-webpack-plugin": "^4.0.0",
Expand Down
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Start(1709712948934)
#Done(1709712949000)
#Start(1709949306018)
#Done(1709949306129)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ninja log v6
0 22 1709712948954362457 src/service/ServiceType.ast 785165cefc5839bb
2 23 1709712948954561547 Meta3dEngineWholeProtocol.cmi 5f7f0af9dc9a4eae
22 35 1709712948969515735 src/service/ServiceType.d c1e4bb8db3eac460
36 66 1709712948999659971 src/service/ServiceType-Meta3dEngineWholeProtocol.cmj 9289db688d33118
36 66 1709712948999659971 src/service/ServiceType-Meta3dEngineWholeProtocol.cmi 9289db688d33118
36 66 1709712948999659971 ../es6_global/src/service/ServiceType.bs.js 9289db688d33118
36 66 1709712948999659971 ../js/src/service/ServiceType.bs.js 9289db688d33118
0 51 1709949306066317060 src/service/ServiceType.ast 785165cefc5839bb
1 61 1709949306069640066 Meta3dEngineWholeProtocol.cmi 5f7f0af9dc9a4eae
52 79 1709949306097357718 src/service/ServiceType.d c1e4bb8db3eac460
79 111 1709949306127861955 src/service/ServiceType-Meta3dEngineWholeProtocol.cmj add6d9188dcc48c9
79 111 1709949306127861955 src/service/ServiceType-Meta3dEngineWholeProtocol.cmi add6d9188dcc48c9
79 111 1709949306127861955 ../es6_global/src/service/ServiceType.bs.js add6d9188dcc48c9
79 111 1709949306127861955 ../js/src/service/ServiceType.bs.js add6d9188dcc48c9
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ module Method = {
}, _)
->Js.Promise.catch(e => {
service.console.errorWithExn(. e->Error.promiseErrorToExn, None)->Obj.magic

// loopFrameID.current =
// service.other.requestAnimationOtherFrame(time => {
// MessageUtils.showCatchedErrorMessage(
// () => {
// _loop(service, loopFrameID, apInspectorData, time, meta3dState)
// },
// 5->Some,
// )
// })->Some

// ()->Js.Promise.resolve

}, _)
->ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ module Method = {
}, _)
->Js.Promise.catch(e => {
service.console.errorWithExn(. e->Error.promiseErrorToExn, None)->Obj.magic

(e->Obj.magic)["errorType"] === "script"
? {
loopFrameID.current =
service.other.requestAnimationOtherFrame(time => {
_loop(service, loopFrameID, apInspectorData, time, meta3dState)
})->Some

()->Js.Promise.resolve
}
: e->Js.Exn.anyToExnInternal->Js.Promise.reject
}, _)
->ignore
}
Expand Down
Empty file modified utils/meta3d-file-utils/lib/es6_global/src/DownloadUtils.bs.js
100755 → 100644
Empty file.
14 changes: 11 additions & 3 deletions utils/meta3d-script-utils/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ let _exec = (meta3dState: meta3dState, api: scriptAPI, eventFileStrData: Array<[

let [gameObject, eventFileStr] = eventFileStrData[index]

return _eval(eventFileStr)[eventHandleName](meta3dState, api, gameObject).then((meta3dState: meta3dState) => {
return _func(meta3dState, index + 1)
})
try {
return _eval(eventFileStr)[eventHandleName](meta3dState, api, gameObject).then((meta3dState: meta3dState) => {
return _func(meta3dState, index + 1)
})
} catch (e: any) {
e.errorType = "script"

return new Promise((resolve, reject) => {
reject(e)
})
}
}

return _func(meta3dState, 0)
Expand Down

0 comments on commit d4b5363

Please sign in to comment.