=== Error Monitor & Notifier ===
Contributors: malferov
Tags: error, debugging, monitoring, reporting, notifications
Requires at least: 5.8
Tested up to: 6.8
Requires PHP: 7.4.0
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Receive notifications with details when PHP errors occur on your WordPress site.

== Description ==

Error notifications help to *immediately* identify the causes of failures and quickly fix bugs so that the site runs smoothly and the business does not lose customers due to hidden errors.

**If you are a developer,** install the plugin to find out about specific errors or all errors in the PHP code, even if the error occurred in an unexpected place that could not be foreseen in advance.

The plugin allows you to configure the types of errors that you want to receive notifications about. Uncaught exceptions won’t break your site — they’re logged and made available for centralized custom handling via the `enot_exception_handler_should_exit` filter. Only real fatal errors stop the script, but you'll still get full error details.

The notification will contain the type of error, the file name, and the line number where the error occurred or an uncaught exception was thrown, as well as a callback stack trace.

**If you are the site owner,** after installing the plugin, specify the email address of the developer who maintains the site in the plugin settings so that the plugin can start detecting and sending messages to the developer about serious errors that cause the business to lose orders or customers.

A notification with detailed information about the causes of the error will indicate to the programmer which plugin or theme caused the failure (which often goes unnoticed for a long time with automatic updates of plugins or themes), and the developer will fix the error before the failure is reported to customers.

It also helps to find out about critical errors even without access to the server logs or WordPress dashboard.

**Note:** The errors named *_NOTICE or *_WARNING are not too severe, but with others, the site breaks down and the user gets a negative experience.

= Features =
* Customizable PHP error levels
* Catch unhandled exceptions from try-catch blocks
* Log stack traces, errors from @ operator, and JavaScript errors (Premium only)
* Display user-friendly messages for critical PHP errors
* Configurable email address for notifications
* Multilingual support: RU, EN
* Free updates to new versions (Premium only)
* Error notifications via email
* Error notifications via Telegram (Premium only)
* JavaScript error alerts (Premium only)
* Database error alerts (Premium only)

== Frequently Asked Questions ==

= How does the plugin send error notifications if my site is down or returns a 500 Internal Server Error? =

**Error Monitor & Notifier** hooks into PHP's shutdown function — a special handler that runs even after fatal errors occur. This means the plugin can detect and report issues like Fatal Error, ParseError, Uncaught Exception, memory limit exhaustion, and other critical PHP crashes.

Even when your site shows a white screen of death (WSOD) or returns **a 500 error,** the plugin captures detailed information about the error — including stack trace, file and line number, URL, user agent, and more — and sends it via email or Telegram right before PHP stops execution.

This ensures you're notified of problems the moment they happen, so you can fix them fast — even if no one reports the issue manually.

= How do I stop getting dozens of duplicate error notifications? =

Enable the "Skip repeated errors" setting.

During development or on live sites, you might receive tens or even hundreds of alerts for the same error. When this option is enabled, the plugin generates a unique hash for each error and skips sending duplicates, reducing spam significantly.

**Tip:** Temporarily disable notifications for specific error types while fixing bugs. Re-enable them once the issue is resolved.

= Can uncaught exceptions crash my site? =

No — thanks to the `enot_exception_handler_should_exit` filter, uncaught exceptions won't crash your site.

Error Monitor & Notifier **catches 100 % of uncaught exceptions and errors** from PHP code — including `Error`, `Exception`, and custom exception types. Even if an exception isn’t handled in a `try-catch` block or comes from a theme/plugin/core, the plugin intercepts it before PHP terminates the script.

Using the `enot_exception_handler_should_exit` filter, you can decide whether to exit the script or continue execution safely:

	add_filter('enot_exception_handler_should_exit', static function (bool $should_exit, \Throwable $e): bool {
	    if ($e instanceof MyCustomException) {
	        my_logger()->log("Caught exception: " . $e->getMessage());
	        return false; // Prevent script termination
	    }

	    return $should_exit;
	}, 10, 2);

= Can I ignore certain errors — like warnings from WooCommerce? =

Yes — use the `enot_ignore_error` filter.

Sometimes you want to suppress noisy or non-critical errors from third-party plugins like WooCommerce or themes. Here's how:

	add_filter('enot_ignore_error', static function (bool $ignore, \ErrorException $e): bool {
	    if ($e->getSeverity() === E_WARNING && strpos($e->getFile(), '/plugins/woocommerce/') !== false) {
	        return true; // Ignore this error
	    }

	    return $ignore;
	}, 10, 2);

**Best practice:** Add this to `mu-plugins/enot-ignore-error.php` to ensure it runs early, even during cron events or AJAX requests.

== Installation ==

Install the plugin just like any other WordPress plugin either upload the plugin files to the `wp-content/plugins/error-monitor-and-notifier` directory.

From the WordPress dashboard:

1. **Visit** Plugins → Add New
2. **Search** for "Error Monitor & Notifier"
3. **Install and Activate** Error Monitor & Notifier from your Plugins page
4. **Click** on the new menu item "Error Monitor" and setup notifications
5. **See** the [documentation](https://wp-error.ru/documentation/?utm_source=wordpress.org&utm_medium=enot-free&utm_campaign=enot)

= Links =
* [Website](https://wp-error.ru/?utm_source=wordpress.org&utm_medium=enot-free&utm_campaign=enot)

== Screenshots ==

1. Admin configuration settings
2. Email notification configuration settings
3. Example email received when an error has been reported

== Changelog ==

= 1.0.4 (2025-06-02): =
- Add E_PARSE to default severities
- Add new filter hook: 'enot_exception_handler_should_exit'
- Add the FAQ section to readme.txt

= 1.0.3 (2025-06-01): =
- Update translation

= 1.0.2 (2025-05-30): =
- Fix uninstall error

= 1.0.1 (2025-05-20): =
- Enable all error level as catchable
- Change the license condition to GPL
- Improve sanitization
- Change the text domain from 'enot' to 'error-monitor-and-notifier'

= 1.0.0 (2025-03-31): =
- Release
