This commit is contained in:
fred 2023-03-16 04:12:48 +01:00
parent af4777df69
commit a713afd017
1 changed files with 41 additions and 41 deletions

View File

@ -2,63 +2,63 @@
class ErrorsHandler { class ErrorsHandler {
public function __construct () { public function __construct () {
} }
static public function kaput ($errorMsgs) { static public function kaput ($errorMsgs) {
ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls) ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls)
if (!is_array($errorMsgs)) { if (!is_array($errorMsgs)) {
$errorMsgs = explode("\n", $errorMsgs); $errorMsgs = explode("\n", $errorMsgs);
} }
echo '<!DOCTYPE html> echo '<!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>'. _('Erreur critique') . '</title> <title>'. ('Erreur critique') . '</title>
<style> <style>
div { div {
overflow: auto; overflow: auto;
word-wrap: break-word; word-wrap: break-word;
background-color: hsl(0, 100%, 69%); background-color: hsl(0, 100%, 69%);
color: hsl(0, 100%, 19%); color: hsl(0, 100%, 19%);
margin: 1em; margin: 1em;
padding: 1em; padding: 1em;
border-radius: 1em; border-radius: 1em;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: calc(100% - 4em); width: calc(100% - 4em);
max-height: calc(100vh - 4em); max-height: calc(100vh - 4em);
} }
</style> </style>
</head> </head>
<body> <body>
<div>'; <div>';
foreach ($errorMsgs as $msg) { foreach ($errorMsgs as $msg) {
echo '<pre>' . print_r($msg, true) . '</pre>'; echo '<pre>' . print_r($msg, true) . '</pre>';
} }
echo ' echo '
</div> </div>
</body> </body>
</html>'; </html>';
die; die;
} }
} }