From 06eb1b7cb852d1e0160cbba54d48255709a8f226 Mon Sep 17 00:00:00 2001 From: keyframes <68995302+7754496@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:33:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展的content和precontent载入失败后会弹窗提示,显示报错信息 报错信息格式: alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); --- noname/game/index.js | 14 ++++++++++---- noname/init/onload.js | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index f8e339b0e..9e2405a4f 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1880,11 +1880,17 @@ export class Game extends Uninstantable { help: help, config: objectConfig } - if (precontent) { - _status.extension = name; - await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); - delete _status.extension; + try{ + if (precontent) { + _status.extension = name; + + await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); + delete _status.extension; + } + }catch(e1){ + alert(`扩展${name}载入失败\nprecontentError\n${decodeURI(e1.stack)}`); } + if (content) lib.extensions.push([name, content, config, _status.evaluatingExtension, objectPackage || {}]); } catch (e) { diff --git a/noname/init/onload.js b/noname/init/onload.js index ab3e67cdd..068a6ac79 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -587,7 +587,11 @@ export async function onload(resetGameTimeout) { _status.extension = lib.extensions[i][0]; _status.evaluatingExtension = lib.extensions[i][3]; if (typeof lib.extensions[i][1] == "function") - await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + try{ + await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + }catch(e){ + alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); + } if (lib.extensions[i][4]) { if (lib.extensions[i][4].character) { for (var j in lib.extensions[i][4].character.character) { From 81d7c9e56fbdd8320a23521ae33e125917110ecc Mon Sep 17 00:00:00 2001 From: keyframes <68995302+7754496@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:57:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展的content和precontent载入失败后会弹窗提示,显示报错信息 报错信息格式: alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); --- noname/game/index.js | 14 ++++++++++---- noname/init/onload.js | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index f8e339b0e..9e2405a4f 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1880,11 +1880,17 @@ export class Game extends Uninstantable { help: help, config: objectConfig } - if (precontent) { - _status.extension = name; - await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); - delete _status.extension; + try{ + if (precontent) { + _status.extension = name; + + await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); + delete _status.extension; + } + }catch(e1){ + alert(`扩展${name}载入失败\nprecontentError\n${decodeURI(e1.stack)}`); } + if (content) lib.extensions.push([name, content, config, _status.evaluatingExtension, objectPackage || {}]); } catch (e) { diff --git a/noname/init/onload.js b/noname/init/onload.js index ab3e67cdd..068a6ac79 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -587,7 +587,11 @@ export async function onload(resetGameTimeout) { _status.extension = lib.extensions[i][0]; _status.evaluatingExtension = lib.extensions[i][3]; if (typeof lib.extensions[i][1] == "function") - await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + try{ + await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + }catch(e){ + alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); + } if (lib.extensions[i][4]) { if (lib.extensions[i][4].character) { for (var j in lib.extensions[i][4].character.character) { From 7a2643986b98f1221a82f9422aaaac60a992e46b Mon Sep 17 00:00:00 2001 From: keyframes <68995302+7754496@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:59:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展的content和precontent载入失败后会弹窗提示,显示报错信息 报错信息格式: alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); --- noname/game/index.js | 14 ++++++++++---- noname/init/onload.js | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index f8e339b0e..9e2405a4f 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1880,11 +1880,17 @@ export class Game extends Uninstantable { help: help, config: objectConfig } - if (precontent) { - _status.extension = name; - await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); - delete _status.extension; + try{ + if (precontent) { + _status.extension = name; + + await (gnc.is.generatorFunc(precontent) ? gnc.of(precontent) : precontent).call(object, config); + delete _status.extension; + } + }catch(e1){ + alert(`扩展${name}载入失败\nprecontentError\n${decodeURI(e1.stack)}`); } + if (content) lib.extensions.push([name, content, config, _status.evaluatingExtension, objectPackage || {}]); } catch (e) { diff --git a/noname/init/onload.js b/noname/init/onload.js index ab3e67cdd..068a6ac79 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -587,7 +587,11 @@ export async function onload(resetGameTimeout) { _status.extension = lib.extensions[i][0]; _status.evaluatingExtension = lib.extensions[i][3]; if (typeof lib.extensions[i][1] == "function") - await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + try{ + await (gnc.is.coroutine(lib.extensions[i][1]) ? gnc.of(lib.extensions[i][1]) : lib.extensions[i][1]).call(lib.extensions[i], lib.extensions[i][2], lib.extensions[i][4]); + }catch(e){ + alert(`扩展${lib.extensions[i][0]}载入失败\ncontentError\n${decodeURI(e.stack)}`); + } if (lib.extensions[i][4]) { if (lib.extensions[i][4].character) { for (var j in lib.extensions[i][4].character.character) {