Skip to content

Commit 959e547

Browse files
committed
Replaced Process.exit with return
1 parent b5b7a87 commit 959e547

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/contentstack-utilities/src/authentication-handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class AuthenticationHandler {
2828
ux.print('Session timed out, please login to proceed', {
2929
color: 'yellow',
3030
});
31-
process.exit(1);
31+
throw new Error('Session timed out, please login to proceed');
3232
}
3333
break;
3434
}
3535
} catch (error) {
3636
ux.print(`Error occurred while fetching auth details: ${error.message}`, {
3737
color: 'red',
3838
});
39-
process.exit(1);
39+
throw new Error(`Error occurred while fetching auth details: ${error.message}`);
4040
}
4141
}
4242

@@ -87,7 +87,7 @@ class AuthenticationHandler {
8787
ux.print('Max retry count reached, please login to proceed', {
8888
color: 'yellow',
8989
});
90-
process.exit(1);
90+
return;
9191
}
9292
maxRetryCount++; // Increment for the next retry attempt
9393
// These cases require a wait, adding a delay before retrying
@@ -106,7 +106,7 @@ class AuthenticationHandler {
106106
ux.print('Session timed out, please login to proceed', {
107107
color: 'yellow',
108108
});
109-
process.exit();
109+
resolve(false);
110110
} else if (this.authType === 'OAUTH') {
111111
authHandler.host = hostName;
112112
// NOTE Handle OAuth refresh token
@@ -124,7 +124,7 @@ class AuthenticationHandler {
124124
ux.print('You do not have the permissions to perform this action, please login to proceed', {
125125
color: 'yellow',
126126
});
127-
process.exit();
127+
resolve(false);
128128
}
129129
});
130130
}

0 commit comments

Comments
 (0)