fix: tb-create-template rolls back posts Divi inserted before failing (ruling Q19)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 16:23:01 +02:00
co-authored by Claude Opus 5.5
parent 42b9b384d5
commit 2827fd4bd8
7 changed files with 406 additions and 14 deletions
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi\ThemeBuilder;
use RuntimeException;
use Throwable;
defined('ABSPATH') || exit;
/**
* Divi failed after its own wp_insert_post() already created posts (a throwing hook, a wp_die() turned into an
* exception by DiviThemeBuilder::guarded()): $postIds are the new posts of the expected types, so the caller can
* roll them back (ruling Q19). The message is the original failure's.
*/
final class InsertedBeforeFailure extends RuntimeException
{
/** @param list<int> $postIds */
public function __construct(string $message, public readonly array $postIds, ?Throwable $previous = null)
{
parent::__construct($message, 0, $previous);
}
}