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

一点建议 #188

Closed
pfdtk opened this issue Dec 28, 2015 · 2 comments
Closed

一点建议 #188

pfdtk opened this issue Dec 28, 2015 · 2 comments

Comments

@pfdtk
Copy link

pfdtk commented Dec 28, 2015

应该预知返回错误抛出异常,比如在拿access token的时候有段代码:

$token = $this->getTokenFromServer();
$this->cache->set($cacheKey, $token['access_token'], $token['expires_in'] - 1500);

你这里总是可以拿到$token['access_token']的。

但事实上会有很多原因会拿不到这个access_token。

其它的接口有类似的情况,应当考虑下错误码和网络的情况。

@overtrue
Copy link
Collaborator

OK,收到

@overtrue
Copy link
Collaborator

$this->getTokenFromServer();

这一步失败会直接异常了,所以不需要判断

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