@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.js CHANGED
@@ -1281,11 +1281,20 @@ var ObjectKernel = class {
1281
1281
  const result = await this.startPluginWithTimeout(plugin);
1282
1282
  if (!result.success) {
1283
1283
  this.logger.error(`Plugin startup failed: ${plugin.name}`, result.error);
1284
- console.error(`[Kernel] Plugin startup failed: ${plugin.name}`, result.error instanceof Error ? result.error.message : result.error, result.error instanceof Error ? result.error.stack : "");
1284
+ const origMsg = result.error instanceof Error ? result.error.message : String(result.error);
1285
+ const origStack = result.error instanceof Error ? result.error.stack : "";
1286
+ console.error(`[Kernel] Plugin startup failed: ${plugin.name}`, origMsg, origStack);
1285
1287
  if (this.config.rollbackOnFailure) {
1286
1288
  this.logger.warn("Rolling back started plugins...");
1287
1289
  await this.rollbackStartedPlugins();
1288
- throw new Error(`Plugin ${plugin.name} failed to start - rollback complete`);
1290
+ const err = new Error(
1291
+ `Plugin ${plugin.name} failed to start - rollback complete: ${origMsg}`
1292
+ );
1293
+ if (result.error instanceof Error) {
1294
+ err.cause = result.error;
1295
+ err.originalStack = origStack;
1296
+ }
1297
+ throw err;
1289
1298
  }
1290
1299
  }
1291
1300
  }