@@ -240,10 +240,12 @@ export async function executeActionInner(
240240 ) } (${ actionParameters . triggerMode } )`
241241 )
242242
243+ let result : ExecuteActionResult | void
244+
243245 try {
244246 const blueprintPersistentState = new PersistentPlayoutStateStore ( playoutModel . playlist . previousPersistentState )
245247
246- const result = await blueprint . blueprint . executeAction (
248+ result = await blueprint . blueprint . executeAction (
247249 actionContext ,
248250 blueprintPersistentState ,
249251 actionParameters . actionId ,
@@ -253,16 +255,6 @@ export async function executeActionInner(
253255 actionParameters . publicData ,
254256 actionParameters . actionOptions ?? { }
255257 )
256- if ( result && result . validationErrors ) {
257- throw UserError . from (
258- new Error (
259- `AdLib Action "${ actionParameters . actionId } " validation failed: ${ JSON . stringify ( result . validationErrors ) } `
260- ) ,
261- UserErrorMessage . ValidationFailed ,
262- undefined ,
263- 409
264- )
265- }
266258
267259 if ( blueprintPersistentState . hasChanges ) {
268260 playoutModel . setBlueprintPersistentState ( blueprintPersistentState . getAll ( ) )
@@ -272,6 +264,17 @@ export async function executeActionInner(
272264 throw UserError . fromUnknown ( err )
273265 }
274266
267+ if ( result && result . validationErrors ) {
268+ throw UserError . from (
269+ new Error (
270+ `AdLib Action "${ actionParameters . actionId } " validation failed: ${ JSON . stringify ( result . validationErrors ) } `
271+ ) ,
272+ UserErrorMessage . ValidationFailed ,
273+ undefined ,
274+ 409
275+ )
276+ }
277+
275278 // Store any notes generated by the action
276279 storeNotificationsForCategory (
277280 playoutModel ,
0 commit comments