Skip to content

Commit

Permalink
fix(player): 加载资源失败时不报错
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Oct 29, 2024
1 parent 1ed4535 commit 616567a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ba-story-player/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1175,9 +1175,12 @@ async function loadAsset<T = any>(param: IAddOptions) {
delay: 1000,
},
async () => {
// console.log(Assets)
const [err, result] = await tryit(() => {
return Assets.load(param).catch((err: ErrorEvent) => {
if (err.message?.includes("ERR_HTTP2_PROTOCOL_ERROR")) {
console.error(`网络连接错误(${param.alias}):${err.message}`);
throw err;
}
if (err.message?.includes("404")) {
// 资源不存在,可以直接返回了
console.error(`资源不存在: ${param.alias}`);
Expand All @@ -1186,7 +1189,9 @@ async function loadAsset<T = any>(param: IAddOptions) {
if (err.message.includes("[Loader.load] Failed to load")) {
// FIXME: 从私库构建 pixi-spine 来支持 spine v4.2+
console.error("暂时不支持 spine v4.2+");
// throw err;
}
throw err;
});
})();
if (err) {
Expand Down

0 comments on commit 616567a

Please sign in to comment.