Skip to content

Instantly share code, notes, and snippets.

@Ataurr
Last active April 15, 2020 10:47
Show Gist options
  • Save Ataurr/9377e5503018a245457be9b7dca97622 to your computer and use it in GitHub Desktop.
Save Ataurr/9377e5503018a245457be9b7dca97622 to your computer and use it in GitHub Desktop.
function _error_debug() {
if ($error = error_get_last()) {
/**
* Usage:
* 1. Create a link here https://beeceptor.com/
* 2. Paste it in $url
* 3. Reproduce the error
* 4. Refresh http://requestb.in/.../inspect and check Request Body (at bottom)
*/
$url = 'https://xpeed.free.beeceptor.com';
switch ($error['type']) {
case E_USER_WARNING:
case E_USER_NOTICE:
break;
default:
wp_remote_post($url . '?' . http_build_query(array('url' => fw_current_url())), array(
'body' => $error['message'] . ' in ' . $error['file'] . ' on line ' . $error['line'],
));
break;
}
}
}
register_shutdown_function('_error_debug');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment