Skip to content

Commit 4712180

Browse files
committed
fix(update): non-zero exit when latest version unknown; dedupe binary failure message
1 parent ca20943 commit 4712180

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/commands/src/commands/update.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ export default defineCommand({
122122
const targetVersion = pinnedVersion ?? (await resolveLatest(method, npmPackage));
123123

124124
if (!targetVersion) {
125-
process.stderr.write(`${color.yellow("Could not determine the latest version.")}\n`);
126-
return;
125+
throw new BailianError(
126+
"Could not determine the latest version.",
127+
ExitCode.GENERAL,
128+
"Check network access, or pass --to <version>.",
129+
);
127130
}
128131

129132
if (targetVersion === currentVersion) {
@@ -157,10 +160,10 @@ export default defineCommand({
157160
? error.hint.replace(/^Re-run:\s*/i, "")
158161
: binaryReinstallHint().trim();
159162
throw new BailianError(
160-
`Automatic binary update failed: ${message}`,
163+
"Automatic binary update failed.",
161164
ExitCode.GENERAL,
162165
`Re-run the install script:\n ${reinstall}`,
163-
{ cause: error },
166+
{ cause: message },
164167
);
165168
}
166169
return;

0 commit comments

Comments
 (0)