File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ unreleased
2+ ==========
3+
4+ * perf: resolve file paths at start up
5+
161.4.3 / 2016-01-17
27==================
38
Original file line number Diff line number Diff line change 1717var accepts = require ( 'accepts' )
1818var escapeHtml = require ( 'escape-html' ) ;
1919var fs = require ( 'fs' ) ;
20+ var path = require ( 'path' )
2021var util = require ( 'util' )
2122
2223/**
2324 * Module variables.
2425 * @private
2526 */
2627
28+ var TEMPLATE_PATH = path . join ( __dirname , '/public/error.html' )
29+ var STYLESHEET_PATH = path . join ( __dirname , '/public/style.css' )
2730var doubleSpaceGlobalRegExp = / / g
2831var inspect = util . inspect
2932var newLineGlobalRegExp = / \n / g
@@ -116,9 +119,9 @@ exports = module.exports = function errorHandler(options) {
116119
117120 // html
118121 if ( type === 'html' ) {
119- fs . readFile ( __dirname + '/public/style.css' , 'utf8' , function ( e , style ) {
122+ fs . readFile ( STYLESHEET_PATH , 'utf8' , function ( e , style ) {
120123 if ( e ) return next ( e ) ;
121- fs . readFile ( __dirname + '/public/error.html' , 'utf8' , function ( e , html ) {
124+ fs . readFile ( TEMPLATE_PATH , 'utf8' , function ( e , html ) {
122125 if ( e ) return next ( e ) ;
123126 var isInspect = ! err . stack && String ( err ) === toString . call ( err )
124127 var errorHtml = ! isInspect
You can’t perform that action at this time.
0 commit comments