---
title: "fswa_glue_error — Action Hook"
description: "Fires when an assigned Code Glue snippet errors during a real dispatch (the delivery itself proceeds with the unmodified payload)."
url: "https://wpwebhooks.org/docs/fswa-glue-error/"
---

[WP Webhooks](https://wpwebhooks.org/) / [Docs](https://wpwebhooks.org/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

| Name | In | Type | Req | Description |
| --- | --- | --- | --- | --- |
| $webhook\_id | param | int | yes | Webhook the snippet is assigned to. |
| $trigger | param | string | yes | Trigger being dispatched. |
| $stage | param | string | yes | \`pre\` (payload transform) or \`post\` (after the response). |
| $snippet\_id | param | int | yes | The failing snippet’s ID. |
| $error | param | string | yes | The 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

[fswa\_glue\_post\_dispatch](https://wpwebhooks.org/docs/fswa-glue-post-dispatch/)[Post-Dispatch Scripting](https://wpwebhooks.org/docs/post-dispatch-scripting/)

/Ready

## Your next automation is  
one sentence away.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [See the Plugin →](https://wpwebhooks.org/wordpress-webhook-plugin/)

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

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","name":"fswa_glue_error — Action Hook — Webhook Actions Docs","description":"Fires when an assigned Code Glue snippet errors during a real dispatch (the delivery itself proceeds with the unmodified payload).","url":"https://wpwebhooks.org/docs/fswa-glue-error/","isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"}}
```
