@@ -35,7 +35,13 @@ type Options = {
3535
3636async function main ( ) {
3737 // Start a version check in the background
38- const cliVersionCheckPromise = checkLatestVersion ( ) ;
38+ // unhandled promise rejection can happen even without the `await`
39+ // so we need a `catch` here.
40+ const cliVersionCheckPromise = checkLatestVersion ( ) . catch ( ( ) => ( {
41+ latestVersion : "unknown" ,
42+ currentVersion : "unknown" ,
43+ isNewerAvailable : false ,
44+ } ) ) ;
3945
4046 // Must load tokens and config before anything else
4147 await authStore . initialize ( ) ;
@@ -91,19 +97,15 @@ async function main() {
9197 }
9298 }
9399
94- try {
95- const { latestVersion, currentVersion, isNewerAvailable } =
96- await cliVersionCheckPromise ;
100+ const { latestVersion, currentVersion, isNewerAvailable } =
101+ await cliVersionCheckPromise ;
97102
98- if ( isNewerAvailable ) {
99- console . info (
100- `A new version of the CLI is available: ${ chalk . yellow (
101- currentVersion ,
102- ) } -> ${ chalk . green ( latestVersion ) } . Update to ensure you have the latest features and bug fixes.`,
103- ) ;
104- }
105- } catch {
106- // Ignore errors
103+ if ( isNewerAvailable ) {
104+ console . info (
105+ `A new version of the CLI is available: ${ chalk . yellow (
106+ currentVersion ,
107+ ) } -> ${ chalk . green ( latestVersion ) } . Update to ensure you have the latest features and bug fixes.`,
108+ ) ;
107109 }
108110
109111 if ( debug ) {
0 commit comments