Description
By throwing a StateException the programmer can stop execution, tell the user the reason why, and optionally offer actions to fix or work around the underlying issue or navigate away.
This should be used whenever the store is in a state where the current action cannot be performed.
Comments
Sometimes it is purley informative, e.g. _"Look, you want to sell this carpet, but it has been sold already."_
Sometimes it offers a solution, e.g. _"We cannot find this item. Do you want to create it?"_
If no actions are given, the default actions *Back* and *To start page* will be used.
Examples
[%if ($shit->get_location() === $fan) {
throw new StateException(
message: "The shit hit the fan.",
actions: ["Clean up the mess" =>"cleanup", "Sneak away" => ".start"]
);
}%]
|
|