@@ -208,48 +208,54 @@ public function getContent(FlattenException $exception)
208
208
$ title = 'Whoops, looks like something went wrong. ' ;
209
209
}
210
210
211
+ if (!$ this ->debug ) {
212
+ return <<<EOF
213
+ <div class="container">
214
+ <h1> $ title</h1>
215
+ </div>
216
+ EOF ;
217
+ }
218
+
211
219
$ content = '' ;
212
- if ($ this ->debug ) {
213
- try {
214
- $ count = count ($ exception ->getAllPrevious ());
215
- $ total = $ count + 1 ;
216
- foreach ($ exception ->toArray () as $ position => $ e ) {
217
- $ ind = $ count - $ position + 1 ;
218
- $ class = $ this ->formatClass ($ e ['class ' ]);
219
- $ message = nl2br ($ this ->escapeHtml ($ e ['message ' ]));
220
- $ content .= sprintf (<<<'EOF'
221
- <div class="trace trace-as-html">
222
- <table class="trace-details">
223
- <thead class="trace-head"><tr><th>
224
- <h3 class="trace-class">
225
- <span class="text-muted">(%d/%d)</span>
226
- <span class="exception_title">%s</span>
227
- </h3>
228
- <p class="break-long-words trace-message">%s</p>
229
- </th></tr></thead>
230
- <tbody>
220
+ try {
221
+ $ count = count ($ exception ->getAllPrevious ());
222
+ $ total = $ count + 1 ;
223
+ foreach ($ exception ->toArray () as $ position => $ e ) {
224
+ $ ind = $ count - $ position + 1 ;
225
+ $ class = $ this ->formatClass ($ e ['class ' ]);
226
+ $ message = nl2br ($ this ->escapeHtml ($ e ['message ' ]));
227
+ $ content .= sprintf (<<<'EOF'
228
+ <div class="trace trace-as-html">
229
+ <table class="trace-details">
230
+ <thead class="trace-head"><tr><th>
231
+ <h3 class="trace-class">
232
+ <span class="text-muted">(%d/%d)</span>
233
+ <span class="exception_title">%s</span>
234
+ </h3>
235
+ <p class="break-long-words trace-message">%s</p>
236
+ </th></tr></thead>
237
+ <tbody>
231
238
EOF
232
- , $ ind , $ total , $ class , $ message );
233
- foreach ($ e ['trace ' ] as $ trace ) {
234
- $ content .= '<tr><td> ' ;
235
- if ($ trace ['function ' ]) {
236
- $ content .= sprintf ('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>) ' , $ this ->formatClass ($ trace ['class ' ]), $ trace ['type ' ], $ trace ['function ' ], $ this ->formatArgs ($ trace ['args ' ]));
237
- }
238
- if (isset ($ trace ['file ' ]) && isset ($ trace ['line ' ])) {
239
- $ content .= $ this ->formatPath ($ trace ['file ' ], $ trace ['line ' ]);
240
- }
241
- $ content .= "</td></tr> \n" ;
239
+ , $ ind , $ total , $ class , $ message );
240
+ foreach ($ e ['trace ' ] as $ trace ) {
241
+ $ content .= '<tr><td> ' ;
242
+ if ($ trace ['function ' ]) {
243
+ $ content .= sprintf ('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>) ' , $ this ->formatClass ($ trace ['class ' ]), $ trace ['type ' ], $ trace ['function ' ], $ this ->formatArgs ($ trace ['args ' ]));
242
244
}
243
-
244
- $ content .= "</tbody> \n</table> \n</div> \n" ;
245
- }
246
- } catch (\Exception $ e ) {
247
- // something nasty happened and we cannot throw an exception anymore
248
- if ($ this ->debug ) {
249
- $ title = sprintf ('Exception thrown when handling an exception (%s: %s) ' , get_class ($ e ), $ this ->escapeHtml ($ e ->getMessage ()));
250
- } else {
251
- $ title = 'Whoops, looks like something went wrong. ' ;
245
+ if (isset ($ trace ['file ' ]) && isset ($ trace ['line ' ])) {
246
+ $ content .= $ this ->formatPath ($ trace ['file ' ], $ trace ['line ' ]);
247
+ }
248
+ $ content .= "</td></tr> \n" ;
252
249
}
250
+
251
+ $ content .= "</tbody> \n</table> \n</div> \n" ;
252
+ }
253
+ } catch (\Exception $ e ) {
254
+ // something nasty happened and we cannot throw an exception anymore
255
+ if ($ this ->debug ) {
256
+ $ title = sprintf ('Exception thrown when handling an exception (%s: %s) ' , get_class ($ e ), $ this ->escapeHtml ($ e ->getMessage ()));
257
+ } else {
258
+ $ title = 'Whoops, looks like something went wrong. ' ;
253
259
}
254
260
}
255
261
@@ -278,6 +284,14 @@ public function getContent(FlattenException $exception)
278
284
*/
279
285
public function getStylesheet (FlattenException $ exception )
280
286
{
287
+ if (!$ this ->debug ) {
288
+ return <<<'EOF'
289
+ body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
290
+ .container { margin: 30px; max-width: 600px; }
291
+ h1 { color: #dc3545; font-size: 24px; }
292
+ EOF;
293
+ }
294
+
281
295
return <<<'EOF'
282
296
body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 45px; }
283
297
0 commit comments