Use the correct status code in the error

parent c5976659
......@@ -19,8 +19,12 @@ export default class Login extends Command {
const hasToken = await cloudAuth.hasToken();
if (hasToken) {
cli.action.start(chalk.green('verifying') + ' your token...');
await cloudAuth.getToken();
cli.action.stop(chalk.green('success, you are already logged in!'));
try {
await cloudAuth.getToken();
cli.action.stop(chalk.green('success, you are already logged in!'));
} catch (e) {
cli.action.stop(chalk.red('failure.'));
}
} else {
try {
cli.action.start(chalk.green('waiting') + ' for authorization...');
......
......@@ -123,7 +123,7 @@ export class CloudAuth {
} catch (err) {
const d = err.response.data;
// tslint:disable-next-line:no-console
console.log(`[${ err.response.statusCode }] error getting token: ${ d.error } (${ d.requestId })`);
console.log(`[${ err.response.status }] error getting token: ${ d.error } (${ d.requestId })`);
throw err;
}
......@@ -155,7 +155,7 @@ export class CloudAuth {
} catch (err) {
const d = err.response.data;
// tslint:disable-next-line:no-console
console.log(`[${ err.response.statusCode }] error getting token refreshed: ${ d.error } (${ d.requestId })`);
console.log(`[${ err.response.status }] error getting token refreshed: ${ d.error } (${ d.requestId })`);
throw err;
}
......
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 to comment