dev_error.ctp 6.9 KB

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