dev_error.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. body {
  27. font: 14px helvetica, arial, sans-serif;
  28. color: #222;
  29. background-color: #f8f8f8;
  30. padding:0;
  31. margin: 0;
  32. max-height: 100%;
  33. }
  34. .code-dump,
  35. pre {
  36. background: #fefefe;
  37. border: 1px solid #ddd;
  38. padding: 5px;
  39. white-space: pre-wrap;
  40. }
  41. header {
  42. background-color: #C3232D;
  43. color: #ffffff;
  44. padding: 16px 10px;
  45. border-bottom: 3px solid #626262;
  46. }
  47. .header-title {
  48. margin: 0;
  49. font-weight: normal;
  50. font-size: 30px;
  51. line-height: 64px;
  52. }
  53. .header-type {
  54. opacity: 0.75;
  55. display: block;
  56. font-size: 16px;
  57. line-height: 1;
  58. }
  59. .header-help {
  60. font-size: 12px;
  61. line-height: 1;
  62. position: absolute;
  63. top: 30px;
  64. right: 16px;
  65. }
  66. .header-help a {
  67. color: #fff;
  68. }
  69. .error-nav {
  70. float: left;
  71. width: 30%;
  72. }
  73. .error-contents {
  74. padding: 10px 1%;
  75. float: right;
  76. width: 68%;
  77. }
  78. .error,
  79. .error-subheading {
  80. font-size: 18px;
  81. margin-top: 0;
  82. padding: 10px;
  83. border: 1px solid #EDBD26;
  84. }
  85. .error-subheading {
  86. background: #1798A5;
  87. color: #fff;
  88. border: 1px solid #02808C;
  89. }
  90. .error {
  91. background: #ffd54f;
  92. }
  93. .customize {
  94. opacity: 0.6;
  95. }
  96. .stack-trace {
  97. list-style: none;
  98. margin: 0;
  99. padding: 0;
  100. }
  101. .stack-frame {
  102. padding: 10px;
  103. border-bottom: 1px solid #212121;
  104. }
  105. .stack-frame:last-child {
  106. border-bottom: none;
  107. }
  108. .stack-frame a {
  109. display: block;
  110. color: #212121;
  111. text-decoration: none;
  112. }
  113. .stack-frame.active {
  114. background: #e5e5e5;
  115. }
  116. .stack-frame a:hover {
  117. text-decoration: underline;
  118. }
  119. .stack-file,
  120. .stack-function {
  121. display: block;
  122. margin-bottom: 5px;
  123. }
  124. .stack-frame-file,
  125. .stack-file {
  126. font-family: consolas, monospace;
  127. }
  128. .stack-function {
  129. font-weight: bold;
  130. }
  131. .stack-file {
  132. font-size: 0.9em;
  133. word-wrap: break-word;
  134. }
  135. .stack-details {
  136. background: #ececec;
  137. box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  138. border: 1px solid #ababab;
  139. padding: 10px;
  140. margin-bottom: 18px;
  141. }
  142. .stack-frame-args {
  143. float: right;
  144. }
  145. .toggle-link {
  146. color: #1798A5;
  147. text-decoration: none;
  148. }
  149. .toggle-link:hover {
  150. text-decoration: underline;
  151. }
  152. .toggle-vendor-frames {
  153. padding: 5px;
  154. display: block;
  155. text-align: center;
  156. }
  157. .code-excerpt {
  158. width: 100%;
  159. margin: 5px 0;
  160. background: #fefefe;
  161. }
  162. .code-highlight {
  163. display: block;
  164. background: #fff59d;
  165. }
  166. .excerpt-line {
  167. padding-left: 2px;
  168. }
  169. .excerpt-number {
  170. background: #f6f6f6;
  171. width: 50px;
  172. text-align: right;
  173. color: #666;
  174. border-right: 1px solid #ddd;
  175. padding: 2px;
  176. }
  177. .excerpt-number:after {
  178. content: attr(data-number);
  179. }
  180. table {
  181. text-align: left;
  182. }
  183. th, td {
  184. padding: 4px;
  185. }
  186. th {
  187. border-bottom: 1px solid #ccc;
  188. }
  189. </style>
  190. </head>
  191. <body>
  192. <header>
  193. <h1 class="header-title">
  194. <?= h($this->fetch('title')) ?>
  195. <span class="header-type"><?= get_class($error) ?></span>
  196. </h1>
  197. <div class="header-help">
  198. <a target="_blank" href="https://book.cakephp.org/3.0/">Documentation</a>
  199. <a target="_blank" href="https://api.cakephp.org/">API</a>
  200. </div>
  201. </header>
  202. <div class="error-contents">
  203. <?php if ($this->fetch('subheading')): ?>
  204. <p class="error-subheading">
  205. <?= $this->fetch('subheading') ?>
  206. </p>
  207. <?php endif; ?>
  208. <?= $this->element('exception_stack_trace'); ?>
  209. <div class="error-suggestion">
  210. <?= $this->fetch('file') ?>
  211. </div>
  212. <?php if ($this->fetch('templateName')): ?>
  213. <p class="customize">
  214. If you want to customize this error message, create
  215. <em><?= APP_DIR . DIRECTORY_SEPARATOR . 'Template' . DIRECTORY_SEPARATOR . 'Error' . DIRECTORY_SEPARATOR . $this->fetch('templateName') ?></em>
  216. </p>
  217. <?php endif; ?>
  218. </div>
  219. <div class="error-nav">
  220. <?= $this->element('exception_stack_trace_nav') ?>
  221. </div>
  222. <script type="text/javascript">
  223. function bindEvent(selector, eventName, listener) {
  224. var els = document.querySelectorAll(selector);
  225. for (var i = 0, len = els.length; i < len; i++) {
  226. els[i].addEventListener(eventName, listener, false);
  227. }
  228. }
  229. function toggleElement(el) {
  230. if (el.style.display === 'none') {
  231. el.style.display = 'block';
  232. } else {
  233. el.style.display = 'none';
  234. }
  235. }
  236. function each(els, cb) {
  237. var i, len;
  238. for (i = 0, len = els.length; i < len; i++) {
  239. cb(els[i], i);
  240. }
  241. }
  242. window.addEventListener('load', function() {
  243. bindEvent('.stack-frame-args', 'click', function(event) {
  244. var target = this.dataset['target'];
  245. var el = document.getElementById(target);
  246. toggleElement(el);
  247. event.preventDefault();
  248. });
  249. var details = document.querySelectorAll('.stack-details');
  250. var frames = document.querySelectorAll('.stack-frame');
  251. bindEvent('.stack-frame a', 'click', function(event) {
  252. each(frames, function(el) {
  253. el.classList.remove('active');
  254. });
  255. this.parentNode.classList.add('active');
  256. each(details, function(el) {
  257. el.style.display = 'none';
  258. });
  259. var target = document.getElementById(this.dataset['target']);
  260. toggleElement(target);
  261. event.preventDefault();
  262. });
  263. bindEvent('.toggle-vendor-frames', 'click', function(event) {
  264. each(frames, function(el) {
  265. if (el.classList.contains('vendor-frame')) {
  266. toggleElement(el);
  267. }
  268. });
  269. event.preventDefault();
  270. });
  271. });
  272. </script>
  273. </body>
  274. </html>