@objectstack/core 6.8.1 → 7.0.0

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/index.cjs CHANGED
@@ -1339,11 +1339,20 @@ var ObjectKernel = class {
1339
1339
  const result = await this.startPluginWithTimeout(plugin);
1340
1340
  if (!result.success) {
1341
1341
  this.logger.error(`Plugin startup failed: ${plugin.name}`, result.error);
1342
- console.error(`[Kernel] Plugin startup failed: ${plugin.name}`, result.error instanceof Error ? result.error.message : result.error, result.error instanceof Error ? result.error.stack : "");
1342
+ const origMsg = result.error instanceof Error ? result.error.message : String(result.error);
1343
+ const origStack = result.error instanceof Error ? result.error.stack : "";
1344
+ console.error(`[Kernel] Plugin startup failed: ${plugin.name}`, origMsg, origStack);
1343
1345
  if (this.config.rollbackOnFailure) {
1344
1346
  this.logger.warn("Rolling back started plugins...");
1345
1347
  await this.rollbackStartedPlugins();
1346
- throw new Error(`Plugin ${plugin.name} failed to start - rollback complete`);
1348
+ const err = new Error(
1349
+ `Plugin ${plugin.name} failed to start - rollback complete: ${origMsg}`
1350
+ );
1351
+ if (result.error instanceof Error) {
1352
+ err.cause = result.error;
1353
+ err.originalStack = origStack;
1354
+ }
1355
+ throw err;
1347
1356
  }
1348
1357
  }
1349
1358
  }