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

rpc_client 的错误处理有问题 #2

Closed
WClouds opened this issue Feb 10, 2022 · 0 comments
Closed

rpc_client 的错误处理有问题 #2

WClouds opened this issue Feb 10, 2022 · 0 comments

Comments

@WClouds
Copy link

WClouds commented Feb 10, 2022

发现3个问题

  1. rpc_client中封装的request,自己使用new Promise封装,错误处理应该使用 return reject的形式,而不是直接 throw Error。建议直接使用request-promise或者axios这些支持async的网络请求库,不要自己封装了。
  2. rpc_client中封装的request 这里直接JSON.parse,如果body本身不是一个合法的json字符串,比如是 xxx<!html>这种,就会导致JSON解析错误
  3. rpc_client中call函数这里,也没有对错误做处理,封装new Promise没有reject错误,会导致外部调用的时候如果SDK报错,外部await超时。
@Qzm6826 Qzm6826 closed this as completed Oct 18, 2023
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