@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.
- package/lib/sfCommand.js +12 -1
- 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
|
-
|
|
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>):',
|