WP Webhooks / Docs / fswa_glue_error
Action Pro since v1.4.0

fswa_glue_error

Fires when an assigned Code Glue snippet errors during a real dispatch (the delivery itself proceeds with the unmodified payload).

$

/ Signature

do_action( 'fswa_glue_error', $webhook_id, $trigger, $stage, $snippet_id, $error )

/ When it fires

A snippet error never breaks the delivery: the snippet runtime catches every Throwable, the payload falls back unmodified, and the error is written to the PHP error log. This hook fires at that moment so you can alert on broken glue instead of discovering it in the logs.

/ Parameters

NameInTypeReqDescription
$webhook_idparamintyesWebhook the snippet is assigned to.
$triggerparamstringyesTrigger being dispatched.
$stageparamstringyes`pre` (payload transform) or `post` (after the response).
$snippet_idparamintyesThe failing snippet’s ID.
$errorparamstringyesThe PHP error message, with the line number when known.

/ Examples

Email the site admin when production glue starts failing

add_action( 'fswa_glue_error', function ( $webhook_id, $trigger, $stage, $snippet_id, $error ) {
    wp_mail(
        get_option( 'admin_email' ),
        sprintf( 'Code Glue error on webhook #%d', $webhook_id ),
        sprintf( "Snippet #%d (%s stage, trigger %s) failed:\n\n%s", $snippet_id, $stage, $trigger, $error )
    );
}, 10, 5 );

/ Related

Ready

Your next automation is
one sentence away.

$ wp plugin install flowsystems-webhook-actions --activate