xp-command 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/index.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  import { copyToClipboard } from "../src/clipboard.js";
25
25
  import { editConfig, getConfig } from "../src/config.js";
26
26
  import { clearLine, hideCursor, showCursor } from "../src/console.js";
27
- import { isAPIError, isEconnRefused } from "../src/error.js";
27
+ import { isAPIError, isConfigError, isEconnRefused } from "../src/error.js";
28
28
  import history from "../src/history.js";
29
29
  import { Logger } from "../src/logger.js";
30
30
  import { sleep } from "../src/sleep.js";
@@ -64,6 +64,17 @@ const processCommand = async (command) => {
64
64
  showCursor();
65
65
  return false;
66
66
  }
67
+ if (isConfigError(error)) {
68
+ spinner.fail(
69
+ chalk.red(
70
+ `${PREFIX} Config error${typeof error.reason === "string" ? " - " + error.reason : ""}`,
71
+ ),
72
+ );
73
+ hideCursor();
74
+ await sleep(1500);
75
+ showCursor();
76
+ return false;
77
+ }
67
78
  }
68
79
 
69
80
  if (command?.toLowerCase() === "config") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-command",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Quick cockpit commands for X-Plane 12 - set your radios, altimeter, autopilot, and more from the terminal while flying.",
5
5
  "keywords": [
6
6
  "xplane",
package/src/error.js CHANGED
@@ -11,6 +11,13 @@ export const isEconnRefused = (error) => {
11
11
  );
12
12
  };
13
13
 
14
+ /**
15
+ * @param {unknown} error
16
+ */
17
+ export const isConfigError = (error) => {
18
+ return Boolean(error instanceof Error && error.name === "YAMLException");
19
+ };
20
+
14
21
  /**
15
22
  * @param {unknown} error
16
23
  */