dev_error.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. ?>
  16. <!DOCTYPE html>
  17. <html>
  18. <head>
  19. <?= $this->Html->charset() ?>
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  21. <title>
  22. Error: <?= h($this->fetch('title')) ?>
  23. </title>
  24. <?= $this->Html->meta('icon') ?>
  25. <style>
  26. * {
  27. box-sizing: border-box;
  28. }
  29. body {
  30. font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  31. color: #404041;
  32. background: #F5F7FA;
  33. font-size: 14px;
  34. letter-spacing: .01em;
  35. line-height: 1.6;
  36. padding: 0 0 40px;
  37. margin: 0;
  38. height: 100%;
  39. }
  40. header {
  41. flex: 1;
  42. background-color: #D33C47;
  43. color: #ffffff;
  44. padding: 10px;
  45. }
  46. .header-title {
  47. font-size: 30px;
  48. margin: 0;
  49. }
  50. .header-type {
  51. display: block;
  52. font-size: 16px;
  53. }
  54. .header-help a {
  55. color: #fff;
  56. }
  57. .error-content {
  58. display: flex;
  59. }
  60. .col-left,
  61. .col-right {
  62. overflow-y: auto;
  63. padding: 15px;
  64. }
  65. .col-left {
  66. flex: 0 0 30%;
  67. }
  68. .col-right {
  69. flex: 1;
  70. }
  71. .toggle-link {
  72. display: block;
  73. padding: 8px 14px;
  74. text-decoration: none;
  75. background-color: #606c76;
  76. border-radius: 4px;
  77. cursor: pointer;
  78. color: #fff;
  79. text-align: center;
  80. margin-bottom: 10px;
  81. }
  82. .toggle-link:hover {
  83. background-color: #D33C47;
  84. }
  85. .code-dump,
  86. pre {
  87. background: #fff;
  88. border-radius: 4px;
  89. padding: 5px;
  90. white-space: pre-wrap;
  91. box-shadow: 0 7px 14px 0 rgba(60,66,87, 0.1), 0 3px 6px 0 rgba(0, 0, 0, .07);
  92. margin: 0;
  93. }
  94. .error,
  95. .error-subheading {
  96. font-size: 18px;
  97. margin-top: 0;
  98. padding: 20px 16px;
  99. }
  100. .error-subheading {
  101. color: #fff;
  102. background-color: #319795;
  103. }
  104. .error-subheading strong {
  105. color: #fff;
  106. background-color: #4fd1c5;
  107. border-radius: 9999px;
  108. padding: 4px 12px;
  109. margin-right: 8px;
  110. }
  111. .error {
  112. color: #fff;
  113. background: #2779BD;
  114. }
  115. .error strong {
  116. color: #fff;
  117. background-color: #6CB2EB;
  118. border-radius: 9999px;
  119. padding: 4px 12px;
  120. margin-right: 8px;
  121. }
  122. .stack-trace {
  123. list-style: none;
  124. margin: 0;
  125. padding: 0;
  126. }
  127. .stack-frame {
  128. padding: 15px 10px;
  129. }
  130. .stack-frame:last-child {
  131. border-bottom: none;
  132. }
  133. .stack-frame a {
  134. display: block;
  135. color: #212121;
  136. text-decoration: none;
  137. }
  138. .stack-frame.active {
  139. background: #e5e5e5;
  140. border-radius: 4px;
  141. }
  142. .stack-frame a:hover {
  143. text-decoration: underline;
  144. }
  145. .stack-frame-header {
  146. display: flex;
  147. align-items: center;
  148. }
  149. .stack-frame-args {
  150. flex: 0 0 150px;
  151. }
  152. .stack-frame-file {
  153. flex: 1;
  154. word-break:break-all;
  155. margin-right: 10px;
  156. font-size: 16px;
  157. }
  158. .stack-file,
  159. .stack-function {
  160. display: block;
  161. }
  162. .stack-frame-file,
  163. .stack-file {
  164. font-family: consolas, monospace;
  165. }
  166. .stack-function {
  167. font-weight: bold;
  168. }
  169. .stack-file {
  170. font-size: 0.9em;
  171. word-wrap: break-word;
  172. }
  173. .stack-details {
  174. background: #ececec;
  175. border-radius: 4px;
  176. box-shadow: 0 7px 14px 0 rgba(60,66,87, 0.1), 0 3px 6px 0 rgba(0, 0, 0, .07);
  177. padding: 10px;
  178. margin-bottom: 18px;
  179. }
  180. .code-excerpt {
  181. width: 100%;
  182. margin: 10px 0;
  183. background: #fefefe;
  184. }
  185. .code-highlight {
  186. display: block;
  187. background: #fff59d;
  188. }
  189. .excerpt-line {
  190. padding-left: 2px;
  191. }
  192. .excerpt-number {
  193. background: #f6f6f6;
  194. width: 50px;
  195. text-align: right;
  196. color: #666;
  197. border-right: 1px solid #ddd;
  198. padding: 2px;
  199. }
  200. .excerpt-number:after {
  201. content: attr(data-number);
  202. }
  203. table {
  204. text-align: left;
  205. }
  206. th, td {
  207. padding: 4px;
  208. }
  209. th {
  210. border-bottom: 1px solid #ccc;
  211. }
  212. </style>
  213. </head>
  214. <body>
  215. <header>
  216. <h1 class="header-title">
  217. <?= h($this->fetch('title')) ?>
  218. </h1>
  219. <span class="header-type"><?= get_class($error) ?></span>
  220. </header>
  221. <div class="error-content">
  222. <div class="col-left">
  223. <?= $this->element('exception_stack_trace_nav') ?>
  224. </div>
  225. <div class="col-right">
  226. <?php if ($this->fetch('subheading')): ?>
  227. <p class="error-subheading">
  228. <?= $this->fetch('subheading') ?>
  229. </p>
  230. <?php endif; ?>
  231. <?= $this->element('exception_stack_trace'); ?>
  232. <div class="error-suggestion">
  233. <?= $this->fetch('file') ?>
  234. </div>
  235. <?php if ($this->fetch('templateName')): ?>
  236. <p class="customize">
  237. If you want to customize this error message, create
  238. <em><?= APP_DIR . DIRECTORY_SEPARATOR . 'Template' . DIRECTORY_SEPARATOR . 'Error' . DIRECTORY_SEPARATOR . $this->fetch('templateName') ?></em>
  239. </p>
  240. <?php endif; ?>
  241. </div>
  242. </div>
  243. <script type="text/javascript">
  244. function bindEvent(selector, eventName, listener) {
  245. var els = document.querySelectorAll(selector);
  246. for (var i = 0, len = els.length; i < len; i++) {
  247. els[i].addEventListener(eventName, listener, false);
  248. }
  249. }
  250. function toggleElement(el) {
  251. if (el.style.display === 'none') {
  252. el.style.display = 'block';
  253. } else {
  254. el.style.display = 'none';
  255. }
  256. }
  257. function each(els, cb) {
  258. var i, len;
  259. for (i = 0, len = els.length; i < len; i++) {
  260. cb(els[i], i);
  261. }
  262. }
  263. window.addEventListener('load', function() {
  264. bindEvent('.stack-frame-args', 'click', function(event) {
  265. var target = this.dataset['target'];
  266. var el = document.getElementById(target);
  267. toggleElement(el);
  268. event.preventDefault();
  269. });
  270. var details = document.querySelectorAll('.stack-details');
  271. var frames = document.querySelectorAll('.stack-frame');
  272. bindEvent('.stack-frame a', 'click', function(event) {
  273. each(frames, function(el) {
  274. el.classList.remove('active');
  275. });
  276. this.parentNode.classList.add('active');
  277. each(details, function(el) {
  278. el.style.display = 'none';
  279. });
  280. var target = document.getElementById(this.dataset['target']);
  281. toggleElement(target);
  282. event.preventDefault();
  283. });
  284. bindEvent('.toggle-vendor-frames', 'click', function(event) {
  285. each(frames, function(el) {
  286. if (el.classList.contains('vendor-frame')) {
  287. toggleElement(el);
  288. }
  289. });
  290. event.preventDefault();
  291. });
  292. });
  293. </script>
  294. </body>
  295. </html>