Skip to content

Commit c87b5b9

Browse files
committed
fix(cli): catch login error
1 parent 4ddb8f4 commit c87b5b9

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.changeset/sixty-chefs-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sql-controller/cli": patch
3+
---
4+
5+
Catch login error

packages/cli/src/actions/sync.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,22 @@ export default async function sync(options: {
3838
...rootAccount,
3939
log: options.verbose,
4040
}));
41-
if (
42-
await driver.checkLogin({
43-
hostname: rootAccount.hostname,
44-
username: rootAccount.username,
45-
password: rootAccount.password,
46-
log: options.verbose,
47-
})
48-
) {
49-
successRootAccount[alias] = true;
50-
} else {
51-
log("error", alias, "Invalid root password");
41+
42+
try {
43+
if (
44+
await driver.checkLogin({
45+
hostname: rootAccount.hostname,
46+
username: rootAccount.username,
47+
password: rootAccount.password,
48+
log: options.verbose,
49+
})
50+
) {
51+
successRootAccount[alias] = true;
52+
} else {
53+
log("error", alias, "Invalid root password");
54+
}
55+
} catch (error) {
56+
log("error", alias, (error as Error).message);
5257
}
5358
}
5459

0 commit comments

Comments
 (0)