File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,12 @@ function errorHandler(
129129    try  { 
130130      if  ( ! err )  return ; 
131131
132+       this . app . emit ( 'error' ,  err ,  this ) ; 
133+ 
132134      // nothing we can do here other 
133135      // than delegate to the app-level 
134136      // 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 ; 
145138
146139      // translate messages 
147140      const  translate  =  ( message )  => 
@@ -243,8 +236,6 @@ function errorHandler(
243236      if  ( _isObject ( err . headers )  &&  Object . keys ( err . headers ) . length  >  0 ) 
244237        this . set ( err . headers ) ; 
245238
246-       this . app . emit ( 'error' ,  err ,  this ) ; 
247- 
248239      // fix page title and description 
249240      const  meta  =  { 
250241        title : this . body . error , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments