Skip to content
Snippets Groups Projects
Commit 8841a7dc authored by michael.minelli's avatar michael.minelli
Browse files

Convert status code numbers to the StatusCode library

parent ae4e4fd7
No related branches found
No related tags found
No related merge requests found
......@@ -75,11 +75,11 @@ class HttpManager {
if ( this.handleCommandErrors ) {
if ( error.response.url && error.response.url.indexOf(Config.apiURL) !== -1 ) {
switch ( error.response.status ) {
case 401: // Unauthorized
case StatusCodes.UNAUTHORIZED: // Unauthorized
logger.error('Session expired or inexistent. Please login again.');
process.exit(1);
break;
case 403: // Forbidden
case StatusCodes.FORBIDDEN: // Forbidden
logger.error('Forbidden access.');
process.exit(1);
break;
......
......@@ -63,7 +63,7 @@ class SessionManager {
} catch ( error ) {
if ( error instanceof AxiosError ) {
if ( error.response ) {
if ( error.response.status === 404 ) {
if ( error.response.status === StatusCodes.NOT_FOUND ) {
spinner.fail('User not found or password incorrect');
} else {
spinner.fail(`Login error: ${ error.response.statusText }`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment