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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user