Merge pull request #955 from 7754496/PR-Branch

扩展加载失败提示
This commit is contained in:
Spmario233 2024-02-16 18:10:59 +08:00 committed by GitHub
commit be591207ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -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) {

View File

@ -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) {