-
Notifications
You must be signed in to change notification settings - Fork 28
Error Tracking for Backup Failure Callbacks to EasyEngine dashboard #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Tracking for Backup Failure Callbacks to EasyEngine dashboard #472
Conversation
…llbacks - Add error type constants for categorized error reporting (validation, config, filesystem, network, database, disk_space, lock, fatal, interrupted, unknown) - Add error tracking properties (message, type, code) to capture failure details - Create capture_error() method to store error information for API callbacks - Enhance dash_shutdown_handler() to auto-capture PHP fatal errors and process interruptions - Update send_dash_failure_callback() to include error details in API payload Error captures added for: - Invalid --dash-auth format (1001) - Unsupported site type (1003) - rclone not installed (2001) - rclone backend not configured (2002) - Concurrent backup process (lock file) (2003) - Insufficient disk space (3001) - Tool installation failures (2010, 2011) - rclone upload failures (4001) - PHP fatal errors (captured from error_get_last) - Process interruptions (Ctrl+C, SIGTERM, SIGKILL)
…tency - Fix indentation inconsistencies in backup functions - Change unsupported site type error code from 1003 to 1002 for consistency - Use consistent error codes for fatal errors (5001) and interruptions (6000) - Improve rclone backend error message to show actual backend name Add error captures for backup operations: - Site files archive creation failure (3002) - WordPress content archive creation failure (3002) - Nginx configuration archive creation failure (3002) - PHP configuration archive creation failure (3002) - Database dump failure (4002) - Database SQL compression failure (3002) Error code reference: - 1xxx: Validation errors (1001, 1002) - 2xxx: Configuration errors (2001, 2002, 2003, 2010, 2011) - 3xxx: Filesystem/archive errors (3001, 3002) - 4xxx: Network/database errors (4001, 4002) - 5xxx: PHP fatal errors (5001) - 6xxx: Process interruptions (6000)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements comprehensive error tracking for backup failures in EasyEngine, enabling the EasyEngine dashboard to receive detailed error context (message, type, and code) when backups fail. Previously, the dashboard only knew that a backup failed without understanding the root cause.
- Adds error type constants and tracking properties to categorize failures into validation, configuration, filesystem, network, database, disk space, lock, fatal, and interrupted errors
- Implements
capture_error()method that records the first error encountered and a shutdown handler that automatically detects PHP fatal errors or interrupted processes - Updates all backup operations to capture errors before calling
EE::error(), ensuring consistent error reporting to the dashboard API
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Error tracking for EasyDash failure callbacks | ||
| private $dash_error_message = ''; | ||
| private $dash_error_type = 'unknown'; |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialization value 'unknown' does not match the constant ERROR_TYPE_UNKNOWN which is defined as 'unknown_error'. This inconsistency means that if no error is captured before the shutdown handler runs, the error_type sent to the dashboard will be 'unknown' instead of 'unknown_error', which doesn't match the documented error types. Consider using self::ERROR_TYPE_UNKNOWN for initialization or changing the value to match the constant.
| private $dash_error_type = 'unknown'; | |
| private $dash_error_type = self::ERROR_TYPE_UNKNOWN; |
| if ( strpos( $output->stdout, $rclone_path ) === false ) { | ||
| EE::error( 'rclone backend easyengine does not exist. Please create it using `rclone config`' ); | ||
| $this->capture_error( | ||
| sprintf( 'rclone backend "%s" is not configured. Please create it using `rclone config`', $rclone_backend ), |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message sent to the dashboard doesn't match the documented message in the PR description. According to the documentation table, error code 2002 should have message "rclone backend easyengine does not exist", but the actual message being sent is "rclone backend "%s" is not configured. Please create it using rclone config". Consider either updating the code to match the documentation or updating the documentation to reflect this more descriptive error message.
| sprintf( 'rclone backend "%s" is not configured. Please create it using `rclone config`', $rclone_backend ), | |
| sprintf( 'rclone backend "%s" does not exist. Please create it using `rclone config`', $rclone_backend ), |
Overview
This PR implements comprehensive error tracking for backup failures, sending detailed error information (message, type, code) to EasyEngine dashboard API when backups fail. Previously, EasyEngine dashboard only knew that a backup failed but had no context about why it failed.
Error Code Reference for EasyEngine dashboard
Error Code Categories
Complete Error Code List
1xxx: Validation Errors
validation_errorvalidation_error2xxx: Configuration Errors
configuration_errorconfiguration_errorlock_errorconfiguration_errorconfiguration_error3xxx: Resource Errors
disk_space_errorfilesystem_errorfilesystem_errorfilesystem_errorfilesystem_errorfilesystem_error4xxx: Network & Database Errors
network_errordatabase_error5xxx: Fatal Errors
fatal_error6xxx: Process Interruptions
interrupted