@salesforce/sf-plugins-core 2.2.1 → 2.2.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.
Files changed (2) hide show
  1. package/lib/sfCommand.js +12 -1
  2. package/package.json +1 -1
package/lib/sfCommand.js CHANGED
@@ -267,6 +267,7 @@ class SfCommand extends core_1.Command {
267
267
  // @ts-expect-error because context is not on Error
268
268
  context: error.context ?? null,
269
269
  });
270
+ // Create printable error object
270
271
  const sfCommandError = {
271
272
  ...sfErrorProperties,
272
273
  ...{
@@ -283,7 +284,17 @@ class SfCommand extends core_1.Command {
283
284
  else {
284
285
  this.logToStderr(this.formatError(sfCommandError));
285
286
  }
286
- throw sfCommandError;
287
+ // Create SfError that can be thrown
288
+ const err = new core_2.SfError(error.message, error.name ?? 'Error',
289
+ // @ts-expect-error because actions is not on Error
290
+ error.actions ?? [], process.exitCode);
291
+ err.context = sfCommandError.context;
292
+ err.stack = sfCommandError.stack;
293
+ // @ts-expect-error because code is not on SfError
294
+ err.code = codeFromError;
295
+ // @ts-expect-error because code is not on SfError
296
+ err.status = sfCommandError.status;
297
+ throw err;
287
298
  }
288
299
  /**
289
300
  * Format errors and actions for human consumption. Adds 'Error (<ErrorCode>):',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Utils for writing Salesforce CLI plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",