diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index fd974416f..4f60d428b 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -8,9 +8,9 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” - [REST API] Expose `residentVms` property on hosts objects -- [VM/Advanced] Clarify *Windows Update* label [#6628](https://github.com/vatesfr/xen-orchestra/issues/6628) (PR [#6632](https://github.com/vatesfr/xen-orchestra/pull/6632)) +- [VM/Advanced] Clarify _Windows Update_ label [#6628](https://github.com/vatesfr/xen-orchestra/issues/6628) (PR [#6632](https://github.com/vatesfr/xen-orchestra/pull/6632)) - [REST API] Add support to destroy VMs and VDIs -- [VM/Advanced] Add configuration flag for *Viridian* platform [#6572](https://github.com/vatesfr/xen-orchestra/issues/6572) (PR [#6631](https://github.com/vatesfr/xen-orchestra/pull/6631)) +- [VM/Advanced] Add configuration flag for _Viridian_ platform [#6572](https://github.com/vatesfr/xen-orchestra/issues/6572) (PR [#6631](https://github.com/vatesfr/xen-orchestra/pull/6631)) - [Licenses] Makes `id` and `boundObjectId` copyable (PR [#6634](https://github.com/vatesfr/xen-orchestra/pull/6634)) ### Bug fixes @@ -44,6 +44,7 @@ - @xen-orchestra/mixins feat - @xen-orchestra/xapi patch - vhd-lib patch +- xo-cli patch - xo-server minor - xo-server-perf-alert patch - xo-web minor diff --git a/packages/xo-cli/index.mjs b/packages/xo-cli/index.mjs index 34f433ecc..d70a6f541 100755 --- a/packages/xo-cli/index.mjs +++ b/packages/xo-cli/index.mjs @@ -32,7 +32,8 @@ const Xo = XoLib.default async function connect() { const { allowUnauthorized, server, token } = await config.load() if (server === undefined) { - throw new Error('no server to connect to!') + const errorMessage = 'Please use `xo-cli --register` to associate with an XO instance first.\n\n' + help() + throw errorMessage } if (token === undefined) { @@ -228,8 +229,7 @@ const help = wrap( $name [=]... Executes a command on the current XO instance. -$name v$version -`.replace(/<([^>]+)>|\$(\w+)/g, function (_, arg, key) { +$name v$version`.replace(/<([^>]+)>|\$(\w+)/g, function (_, arg, key) { if (arg) { return '<' + chalk.yellow(arg) + '>' } @@ -285,7 +285,7 @@ async function main(args) { // correctly displayed by `exec-promise`. // // Extracts the original error for a better display. - throw 'error' in error ? error.error : error + throw typeof error === 'object' && 'error' in error ? error.error : error } }