camunda-cli 0.4.2 → 0.4.3

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/camunda.js CHANGED
@@ -24,7 +24,7 @@ program
24
24
  'Start with "camunda inspect <key>" to read a deployed model, and\n' +
25
25
  '"camunda diagnose <instanceId>" when an instance misbehaves.'
26
26
  )
27
- .version('0.4.2')
27
+ .version('0.4.3')
28
28
  .option('--json', 'print the raw API payload instead of a formatted view')
29
29
  .option('--no-color', 'never emit colour, even on a terminal')
30
30
  .showHelpAfterError()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camunda-cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Command-line client for self-hosted Camunda 7: inspect and lint deployed BPMN models, and diagnose why an instance is stuck",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -65,7 +65,23 @@ export async function messageCommand(name, options) {
65
65
  if (options.businessKey) body.businessKey = options.businessKey;
66
66
  if (options.all) body.all = true;
67
67
 
68
- const result = await client.correlateMessage(body);
68
+ // Camunda answers a message that matches nothing with an exception rather than an empty
69
+ // result, so the ordinary case of getting the name or business key wrong arrives as a
70
+ // Java class name unless it is caught here.
71
+ let result;
72
+ try {
73
+ result = await client.correlateMessage(body);
74
+ } catch (err) {
75
+ const raw = err.body?.message || err.message || '';
76
+ if (/MismatchingMessageCorrelation|No process definition or execution matches/.test(raw)) {
77
+ out.warn(`Nothing is waiting for a message called "${name}"${options.instance ? ` on instance ${options.instance}` : ''}${options.businessKey ? ` with business key ${options.businessKey}` : ''}.`);
78
+ out.note('camunda subscriptions shows what is currently waiting, and under which name.');
79
+ process.exitCode = 1;
80
+ return;
81
+ }
82
+ throw err;
83
+ }
84
+
69
85
  if (out.isJsonMode()) return out.json(result);
70
86
 
71
87
  if (!result || result.length === 0) {