Skip to content

Outcome

type Outcome =
| CommittedOutcome
| VetoedOutcome
| UnavailableOutcome
| InvalidOutcome
| ConflictOutcome
| CancelledOutcome
| FailedOutcome;

What happened to an intent. It is one of seven forms, which are told apart by status: committed when the change was applied, vetoed when a plugin refused it, unavailable when it cannot be performed in the current context, invalid when the request was not acceptable, conflict when the library changed while the app waited for a deferred decision, cancelled when the change was abandoned, and failed when an error stopped it.

const outcome = await ctx.dispatch(ctx.rows.modify.intent({ id: row.id, title: 'Buy milk' }));
if (outcome.status === 'vetoed') ctx.log('warn', `Refused by ${outcome.by}: ${outcome.message}`);