@4ge/cli 0.2.3 → 0.2.4
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/dist/base.js +8 -3
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -413,11 +413,16 @@ export class BaseCommand extends Command {
|
|
|
413
413
|
this.log(` Payload: ${JSON.stringify(payload, null, 2)}`);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
// Handle errors
|
|
416
|
+
// Handle errors. In JSON mode emit a structured envelope for unexpected
|
|
417
|
+
// errors, then re-throw so the framework sets the exit code. Intentional
|
|
418
|
+
// exit errors (oclif ExitError, thrown by this.exit()/outputErrorAndExit)
|
|
419
|
+
// are NOT re-emitted in JSON mode — the command has already produced any
|
|
420
|
+
// envelope it intended to, and re-emitting would double-print a trailing
|
|
421
|
+
// {data:null,error:{EEXIT}} envelope (#34). The framework renders
|
|
422
|
+
// ExitError as empty (no output) and exits non-zero, matching pretty mode.
|
|
417
423
|
async catch(error) {
|
|
418
|
-
if (this.isJsonMode) {
|
|
424
|
+
if (this.isJsonMode && error?.code !== 'EEXIT') {
|
|
419
425
|
this.outputError({ message: error.message, code: error.code || error.constructor.name });
|
|
420
|
-
this.exit(1);
|
|
421
426
|
}
|
|
422
427
|
throw error;
|
|
423
428
|
}
|