Skip to content

Commit e469021

Browse files
authored
Merge pull request #9044 from kenjis/feat-add-400-page
feat: add "400 Bad Request" page for end users
2 parents b4c7879 + 1e06ee5 commit e469021

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title><?= lang('Errors.badRequest') ?></title>
6+
7+
<style>
8+
div.logo {
9+
height: 200px;
10+
width: 155px;
11+
display: inline-block;
12+
opacity: 0.08;
13+
position: absolute;
14+
top: 2rem;
15+
left: 50%;
16+
margin-left: -73px;
17+
}
18+
body {
19+
height: 100%;
20+
background: #fafafa;
21+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
22+
color: #777;
23+
font-weight: 300;
24+
}
25+
h1 {
26+
font-weight: lighter;
27+
letter-spacing: normal;
28+
font-size: 3rem;
29+
margin-top: 0;
30+
margin-bottom: 0;
31+
color: #222;
32+
}
33+
.wrap {
34+
max-width: 1024px;
35+
margin: 5rem auto;
36+
padding: 2rem;
37+
background: #fff;
38+
text-align: center;
39+
border: 1px solid #efefef;
40+
border-radius: 0.5rem;
41+
position: relative;
42+
}
43+
pre {
44+
white-space: normal;
45+
margin-top: 1.5rem;
46+
}
47+
code {
48+
background: #fafafa;
49+
border: 1px solid #efefef;
50+
padding: 0.5rem 1rem;
51+
border-radius: 5px;
52+
display: block;
53+
}
54+
p {
55+
margin-top: 1.5rem;
56+
}
57+
.footer {
58+
margin-top: 2rem;
59+
border-top: 1px solid #efefef;
60+
padding: 1em 2em 0 2em;
61+
font-size: 85%;
62+
color: #999;
63+
}
64+
a:active,
65+
a:link,
66+
a:visited {
67+
color: #dd4814;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<div class="wrap">
73+
<h1>400</h1>
74+
75+
<p>
76+
<?php if (ENVIRONMENT !== 'production') : ?>
77+
<?= nl2br(esc($message)) ?>
78+
<?php else : ?>
79+
<?= lang('Errors.sorryBadRequest') ?>
80+
<?php endif; ?>
81+
</p>
82+
</div>
83+
</body>
84+
</html>

system/Language/en/Errors.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
return [
1616
'pageNotFound' => '404 - Page Not Found',
1717
'sorryCannotFind' => 'Sorry! Cannot seem to find the page you were looking for.',
18+
'badRequest' => '400 - Bad Request',
19+
'sorryBadRequest' => 'Sorry! Something is wrong with your request.',
1820
'whoops' => 'Whoops!',
1921
'weHitASnag' => 'We seem to have hit a snag. Please try again later...',
2022
];

user_guide_src/source/changelogs/v4.6.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,14 @@ Others
159159
arguments in before or after.
160160
- **Services:** Added ``BaseService::resetServicesCache()`` method to reset
161161
the services cache. See :ref:`resetting-services-cache`.
162+
- **Errors:** Added a default error page for "400 Bad Request".
162163

163164
***************
164165
Message Changes
165166
***************
166167

167168
- Added ``Validation.min_dims`` message
169+
- Added ``Errors.badRequest`` and ``Errors.sorryBadRequest``
168170

169171
*******
170172
Changes

0 commit comments

Comments
 (0)