Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser.load方法没有做res.statusCode的异常处理 #11

Closed
editcue opened this issue Dec 25, 2021 · 1 comment
Closed

Parser.load方法没有做res.statusCode的异常处理 #11

editcue opened this issue Dec 25, 2021 · 1 comment

Comments

@editcue
Copy link

editcue commented Dec 25, 2021

服务器404或其他代码,直接就throw error了,捕获异常并执行rejector
这里要做一下异常捕获

wx.request({
    url: url,
    // @ts-ignore
    dataType: "arraybuffer",
    responseType: "arraybuffer",
    success: function (res) {
        try{
            var inflatedData = inflate(res.data);
            var movieData = ProtoMovieEntity.decode(inflatedData);
            resolver(new video_entity_1.VideoEntity(movieData));
        }catch(error){rejector(error)}
    },
    fail: function (error) {
        rejector(error);
    },
});
@PonyCui
Copy link
Member

PonyCui commented Dec 29, 2021

ebf35ef

@PonyCui PonyCui closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants