Skip to content

Commit 6353a50

Browse files
committed
Added fix for apply errors not being reported
1 parent e83ef41 commit 6353a50

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/plugins/plugin-process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { IpcMessage, IpcMessageSchema, MessageCmd, SudoRequestData, SudoRequestD
22
import { ChildProcess, fork } from 'node:child_process';
33
import { createRequire } from 'node:module';
44

5-
import { ctx, Event } from '../events/context.js';
5+
import { Event, ctx } from '../events/context.js';
66
import { ajv } from '../utils/ajv.js';
77
import { MessageForResultSender } from './message-sender.js';
88

src/plugins/plugin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ export class Plugin {
7777
return new ResourcePlan(data);
7878
}
7979

80-
async apply(plan: PlanResponseData): Promise<void> {
81-
await this.process!.sendMessageForResult({ cmd: 'apply', data: { plan } });
80+
async apply(plan: ResourcePlan): Promise<void> {
81+
const result = await this.process!.sendMessageForResult({ cmd: 'apply', data: { plan } });
82+
83+
if (result.status === MessageStatus.ERROR) {
84+
throw new Error(`Apply error for plugin: "${this.name}", resource: "${plan.resourceType}" \n\n` + result.data);
85+
}
8286
}
8387

8488
private validateInitializeResponse(response: unknown): response is InitializeResponseData {

0 commit comments

Comments
 (0)