chirpie 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -27,6 +27,14 @@ function success(msg) {
27
27
  function error(msg) {
28
28
  console.error(`\x1B[31m\u2717\x1B[0m ${msg}`);
29
29
  }
30
+ function apiError(err, fallback) {
31
+ const maybe = err;
32
+ if (typeof maybe?.code === "string" && typeof maybe?.message === "string") {
33
+ error(`${maybe.code}: ${maybe.message}`);
34
+ return;
35
+ }
36
+ error(err instanceof Error ? err.message : fallback);
37
+ }
30
38
  function info(msg) {
31
39
  console.log(`\x1B[36m\u2139\x1B[0m ${msg}`);
32
40
  }
@@ -181,7 +189,7 @@ var postCommand = new Command3("post").description("Create a post").argument("<t
181
189
  success(`Post created (${post.id})`);
182
190
  }
183
191
  } catch (err) {
184
- error(err instanceof Error ? err.message : "Failed to create post");
192
+ apiError(err, "Failed to create post");
185
193
  process.exit(1);
186
194
  }
187
195
  });
@@ -264,7 +272,7 @@ var threadCommand = new Command4("thread").description("Create a thread").argume
264
272
  success(`Thread created with ${thread.posts.length} posts (${thread.id})`);
265
273
  }
266
274
  } catch (err) {
267
- error(err instanceof Error ? err.message : "Failed to create thread");
275
+ apiError(err, "Failed to create thread");
268
276
  process.exit(1);
269
277
  }
270
278
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chirpie",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Chirpie CLI — post to social media from the command line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@chirpie/sdk": "^1.0.11",
48
+ "@chirpie/sdk": "^1.0.12",
49
49
  "commander": "^13"
50
50
  },
51
51
  "devDependencies": {