Commit ca73ce60 by 马玮

Fix try catch

parent c7b520f9
...@@ -89,13 +89,14 @@ class Autohome extends Base { ...@@ -89,13 +89,14 @@ class Autohome extends Base {
throw new errors.TryLoginError('登录失效'); throw new errors.TryLoginError('登录失效');
} }
} catch (e) { } catch (e) {
throw new errors.TryLoginError(e);
} }
} }
async login() { async login() {
// 随机返回登录状态 // 随机返回登录状态
// return [new errors.LoginError('登录失败'), randomInt(0, 1)]; // return [new errors.LoginError('登录失败'), randomInt(0, 1)];
try {
logger.info('开始表单登录'); logger.info('开始表单登录');
const username = this.params.username; const username = this.params.username;
...@@ -168,6 +169,9 @@ class Autohome extends Base { ...@@ -168,6 +169,9 @@ class Autohome extends Base {
} else { } else {
throw new errors.LoginError('登录失败'); throw new errors.LoginError('登录失败');
} }
} catch (e) {
throw new errors.LoginError(e);
}
} }
// 抓取线索 // 抓取线索
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment