express-error
Advanced tools
Comparing version 0.0.5-pre to 0.0.5
@@ -1,3 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.6.3 | ||
module.exports = require("./lib/expressError"); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.6.3 | ||
var FS, HOME, Path, Utils, alignLeft, betterStack, env, formatHtml, formatText, handleUncaughtExceptions, htmlEscape, injectSourceLines; | ||
@@ -40,3 +40,3 @@ | ||
injectSourceLines = function(lines, contextLinesCount) { | ||
var cache, codeFile, coffee, col, collectSource, ext, i, lineObj, linenum, matches, newLines, pushLine, re, text; | ||
var cache, codeFile, coffee, col, collectSource, err, ext, i, lineObj, linenum, matches, newLines, pushLine, re, text; | ||
newLines = []; | ||
@@ -107,3 +107,4 @@ collectSource = true; | ||
pushLine(text); | ||
} catch (err) { | ||
} catch (_error) { | ||
err = _error; | ||
console.log(err.stack); | ||
@@ -130,4 +131,7 @@ } | ||
var line, lines, result, _i, _len; | ||
if (!stack) { | ||
return ""; | ||
} | ||
result = []; | ||
lines = stack.split("\n"); | ||
result = []; | ||
for (_i = 0, _len = lines.length; _i < _len; _i++) { | ||
@@ -209,3 +213,15 @@ line = lines[_i]; | ||
return function(err, req, res, next) { | ||
var accept, message, newerr; | ||
var accept, message, name, newerr, status; | ||
if (typeof err === "number") { | ||
status = err; | ||
name = http.STATUS_CODES[status]; | ||
err = new Error(name); | ||
err.name = name; | ||
err.status = status; | ||
} else if (typeof err === "string") { | ||
name = err; | ||
err = new Error(name); | ||
err.name = name; | ||
err.status = 500; | ||
} | ||
if (err.status) { | ||
@@ -212,0 +228,0 @@ res.statusCode = err.status; |
@@ -1,3 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.6.3 | ||
exports.tabToSpaces = function(s, spaceCount) { | ||
@@ -4,0 +3,0 @@ var char, chars, i, k, len, out, spaces, _i, _j; |
{ | ||
"name": "express-error", | ||
"version": "0.0.5-pre", | ||
"version": "0.0.5", | ||
"description": "Display source code in express' error stack for JavaScript or CoffeeScript", | ||
"keywords": "express3 error stack coffee-script coffee", | ||
"keywords": ["express3", "error", "coffee-script", "coffee"], | ||
"main": "index.js", | ||
@@ -7,0 +7,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
90128
554