瀏覽代碼

[Web] Show error when connection to redis fails (instead of 5xx)

andryyy 6 年之前
父節點
當前提交
8537767443
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      data/web/inc/prerequisites.inc.php

+ 9 - 1
data/web/inc/prerequisites.inc.php

@@ -41,7 +41,15 @@ $tfa = new RobThree\Auth\TwoFactorAuth($OTP_LABEL, 6, 30, 'sha1', $qrprovider);
 
 
 // Redis
 // Redis
 $redis = new Redis();
 $redis = new Redis();
-$redis->connect('redis-mailcow', 6379);
+try {
+  $redis->connect('redis-mailcow', 6379);
+}
+catch (Exception $e) {
+?>
+<center style='font-family:sans-serif;'>Connection to Redis failed.<br /><br />The following error was reported:<br/><?=$e->getMessage();?></center>
+<?php
+exit;
+}
 
 
 // PDO
 // PDO
 // Calculate offset
 // Calculate offset