@@ -89,10 +89,6 @@ public function createResponse($exception)
89
89
*/
90
90
public function getContent (FlattenException $ exception )
91
91
{
92
- if (!$ this ->debug ) {
93
- return '' ;
94
- }
95
-
96
92
$ title = '' ;
97
93
switch ($ exception ->getStatusCode ()) {
98
94
case 404 :
@@ -102,49 +98,52 @@ public function getContent(FlattenException $exception)
102
98
$ title = 'Whoops, looks like something went wrong. ' ;
103
99
}
104
100
105
- try {
106
- $ message = nl2br ($ exception ->getMessage ());
107
- $ class = $ this ->abbrClass ($ exception ->getClass ());
108
- $ count = count ($ exception ->getAllPrevious ());
109
- $ content = '' ;
110
- foreach ($ exception ->toArray () as $ position => $ e ) {
111
- $ ind = $ count - $ position + 1 ;
112
- $ total = $ count + 1 ;
113
- $ class = $ this ->abbrClass ($ e ['class ' ]);
114
- $ message = nl2br ($ e ['message ' ]);
115
- $ content .= sprintf (<<<EOF
116
- <div class="block_exception clear_fix">
117
- <h2><span>%d/%d</span> %s: %s</h2>
118
- </div>
119
- <div class="block">
120
- <ol class="traces list_exception">
101
+ $ content = '' ;
102
+ if ($ this ->debug ) {
103
+ try {
104
+ $ message = nl2br ($ exception ->getMessage ());
105
+ $ class = $ this ->abbrClass ($ exception ->getClass ());
106
+ $ count = count ($ exception ->getAllPrevious ());
107
+ $ content = '' ;
108
+ foreach ($ exception ->toArray () as $ position => $ e ) {
109
+ $ ind = $ count - $ position + 1 ;
110
+ $ total = $ count + 1 ;
111
+ $ class = $ this ->abbrClass ($ e ['class ' ]);
112
+ $ message = nl2br ($ e ['message ' ]);
113
+ $ content .= sprintf (<<<EOF
114
+ <div class="block_exception clear_fix">
115
+ <h2><span>%d/%d</span> %s: %s</h2>
116
+ </div>
117
+ <div class="block">
118
+ <ol class="traces list_exception">
121
119
122
120
EOF
123
- , $ ind , $ total , $ class , $ message );
124
- foreach ($ e ['trace ' ] as $ i => $ trace ) {
125
- $ content .= ' <li> ' ;
126
- if ($ trace ['function ' ]) {
127
- $ content .= sprintf ('at %s%s%s(%s) ' , $ this ->abbrClass ($ trace ['class ' ]), $ trace ['type ' ], $ trace ['function ' ], $ this ->formatArgs ($ trace ['args ' ]));
128
- }
129
- if (isset ($ trace ['file ' ]) && isset ($ trace ['line ' ])) {
130
- if ($ linkFormat = ini_get ('xdebug.file_link_format ' )) {
131
- $ link = str_replace (array ('%f ' , '%l ' ), array ($ trace ['file ' ], $ trace ['line ' ]), $ linkFormat );
132
- $ content .= sprintf (' in <a href="%s" title="Go to source">%s line %s</a> ' , $ link , $ trace ['file ' ], $ trace ['line ' ]);
133
- } else {
134
- $ content .= sprintf (' in %s line %s ' , $ trace ['file ' ], $ trace ['line ' ]);
121
+ , $ ind , $ total , $ class , $ message );
122
+ foreach ($ e ['trace ' ] as $ i => $ trace ) {
123
+ $ content .= ' <li> ' ;
124
+ if ($ trace ['function ' ]) {
125
+ $ content .= sprintf ('at %s%s%s(%s) ' , $ this ->abbrClass ($ trace ['class ' ]), $ trace ['type ' ], $ trace ['function ' ], $ this ->formatArgs ($ trace ['args ' ]));
135
126
}
127
+ if (isset ($ trace ['file ' ]) && isset ($ trace ['line ' ])) {
128
+ if ($ linkFormat = ini_get ('xdebug.file_link_format ' )) {
129
+ $ link = str_replace (array ('%f ' , '%l ' ), array ($ trace ['file ' ], $ trace ['line ' ]), $ linkFormat );
130
+ $ content .= sprintf (' in <a href="%s" title="Go to source">%s line %s</a> ' , $ link , $ trace ['file ' ], $ trace ['line ' ]);
131
+ } else {
132
+ $ content .= sprintf (' in %s line %s ' , $ trace ['file ' ], $ trace ['line ' ]);
133
+ }
134
+ }
135
+ $ content .= "</li> \n" ;
136
136
}
137
- $ content .= "</li> \n" ;
138
- }
139
137
140
- $ content .= " </ol> \n</div> \n" ;
141
- }
142
- } catch (\Exception $ e ) {
143
- // something nasty happened and we cannot throw an exception anymore
144
- if ($ this ->debug ) {
145
- $ title = sprintf ('Exception thrown when handling an exception (%s: %s) ' , get_class ($ exception ), $ exception ->getMessage ());
146
- } else {
147
- $ title = 'Whoops, looks like something went wrong. ' ;
138
+ $ content .= " </ol> \n</div> \n" ;
139
+ }
140
+ } catch (\Exception $ e ) {
141
+ // something nasty happened and we cannot throw an exception anymore
142
+ if ($ this ->debug ) {
143
+ $ title = sprintf ('Exception thrown when handling an exception (%s: %s) ' , get_class ($ exception ), $ exception ->getMessage ());
144
+ } else {
145
+ $ title = 'Whoops, looks like something went wrong. ' ;
146
+ }
148
147
}
149
148
}
150
149
0 commit comments