File tree 1 file changed +3
-12
lines changed
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,12 @@ function errorHandler(
129
129
try {
130
130
if ( ! err ) return ;
131
131
132
+ this . app . emit ( 'error' , err , this ) ;
133
+
132
134
// nothing we can do here other
133
135
// than delegate to the app-level
134
136
// handler and log.
135
- if ( this . headerSent || ! this . writable ) {
136
- err . headerSent = true ;
137
- this . app . emit ( 'error' , err , this ) ;
138
- this . app . emit (
139
- 'error' ,
140
- new Error ( 'Headers were already sent, returning early' ) ,
141
- this
142
- ) ;
143
- return ;
144
- }
137
+ if ( this . headerSent || ! this . writable ) return ;
145
138
146
139
// translate messages
147
140
const translate = ( message ) =>
@@ -243,8 +236,6 @@ function errorHandler(
243
236
if ( _isObject ( err . headers ) && Object . keys ( err . headers ) . length > 0 )
244
237
this . set ( err . headers ) ;
245
238
246
- this . app . emit ( 'error' , err , this ) ;
247
-
248
239
// fix page title and description
249
240
const meta = {
250
241
title : this . body . error ,
You can’t perform that action at this time.
0 commit comments