Moved show-exceptions to express/pages
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 603558c · Browse files · 3 files·+33 added−33 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+33 added−33 removed
- other:+33 added−33 removed
Provenance
- Commit
5fdd4c3- Tree
a25fc47- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
603558c
3 files changed+33 added−33 removed
added:lib/express/pages/show-exceptions.js+32 added
1234567891011121314151617181920212223242526272829303132
// Express - Show Exceptions - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
var style = require('express/pages/style').style
exports.render = function(e) { contentType('html') if (e.stack) var stack = $(e.stack.split('\n').slice(1)).map(function(val, i){ if (!i) return '<li>' + val.replace(/^(.*?):/, '<span class="path">$1</span>:') + '</li>' return '<li>' + val .replace(/\(([^:]+)/, '(<span class="path">$1</span>') .replace(/(:\d+:\d+)/, '<span class="line">$1</span>') + '</li>' }).toArray().join('\n') return '<html> \n\ <head> \n\ <title>Express -- ' + e + '</title> \n\ ' + style + ' \n\ </head> \n\ <body> \n\ <div id="wrapper"> \n\ <h1>Express</h1> \n\ <h2><em>500</em> ' + e + '</h2> \n\ <ul id="stacktrace"> \n\ ' + stack + ' \n\ </ul> \n\ </div> \n\ </body> \n\ </html>'}No newline at end of filemodified:lib/express/core.js+1 added-1 removed
259 unmodified lines260 catch (e) {261 if (e instanceof ExpressError)262 throw e263 if (accepts('html') && set('show exceptions'))264- halt(500, require('express/show-exceptions').render(e))264+ halt(500, require('express/pages/show-exceptions').render(e))265 else266 halt(500)267 if (set('throw exceptions'))268 throw e37 unmodified linesdeleted:lib/express/show-exceptions.js-32 removed
1234567891011121314151617181920212223242526272829303132
// Express - Show Exceptions - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
var style = require('express/pages/style').style
exports.render = function(e) { contentType('html') if (e.stack) var stack = $(e.stack.split('\n').slice(1)).map(function(val, i){ if (!i) return '<li>' + val.replace(/^(.*?):/, '<span class="path">$1</span>:') + '</li>' return '<li>' + val .replace(/\(([^:]+)/, '(<span class="path">$1</span>') .replace(/(:\d+:\d+)/, '<span class="line">$1</span>') + '</li>' }).toArray().join('\n') return '<html> \n\ <head> \n\ <title>Express -- 500</title> \n\ ' + style + ' \n\ </head> \n\ <body> \n\ <div id="wrapper"> \n\ <h1>Express</h1> \n\ <h2><em>500</em> ' + e + '</h2> \n\ <ul id="stacktrace"> \n\ ' + stack + ' \n\ </ul> \n\ </div> \n\ </body> \n\ </html>'}No newline at end of file