Skip to content
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

Add option to email any critical error message to an admin #4986

Closed
Jimmi08 opened this issue Mar 5, 2023 · 2 comments
Closed

Add option to email any critical error message to an admin #4986

Jimmi08 opened this issue Mar 5, 2023 · 2 comments
Labels
type: enhancement An improvement or new feature request
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Mar 5, 2023

Motivation

The troubles of the hosting provider is without your control. In my case, the database server was out for some time and users saw an English message about a critical error with advice to check the configuration file. But it wasn't true, the configuration file was correct.

Proposed Solution

  • if there is a live site - no debug, developer mode, not localhost or something like that, display the user some nice message about troubles on site, we are working on it
  • replace file name e107_config.php similar way as other error strings - your configuration file - a person that is able to fix this knows the file name of the config file
  • don't display the database name in the error message on the live site
  • improve message look
  • translate messages (those from lan_error.php) - site language should be cached in a file (so available without database connection)
  • add main admin notification if site is down because this issue

Additional Context

It looks like this now:
image

At least this is helping:
image

It would be nice to update the legacy code too. My editor is telling me this and I really don't know if they are false errors or how it is possible that it is workin
image

@Jimmi08 Jimmi08 added the type: enhancement An improvement or new feature request label Mar 5, 2023
@CaMer0n
Copy link
Member

CaMer0n commented Mar 23, 2023

@Jimmi08 Did you try uncommenting the following in e107_config.php ?

// define('e_LOG_CRITICAL', true); // log critical errors but do not display them to user.

CaMer0n added a commit that referenced this issue Mar 23, 2023
…s. (one email per day)

Usage: Add the following to e107_config.php, replacing the email address with your own.

define('e_EMAIL_CRITICAL', 'myemail@somewhere.com');
@CaMer0n
Copy link
Member

CaMer0n commented Mar 23, 2023

Added a new option as well:

define('e_EMAIL_CRITICAL', 'mail@somewhere.com');

The server will email in the case of a critical error, and the end user will see:

CRITICAL ERROR:
The server encountered an internal error or misconfiguration and was unable to complete your request

@CaMer0n CaMer0n added this to the e107 2.3.3 milestone Mar 24, 2023
@CaMer0n CaMer0n closed this as completed Mar 24, 2023
CaMer0n added a commit that referenced this issue Mar 24, 2023
…error constant as example to e107_config.php during installation.
@CaMer0n CaMer0n changed the title improving critical error message for users when there are issues on live site Add option to email any critical error message to an admin Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement An improvement or new feature request
Projects
None yet
Development

No branches or pull requests

2 participants