Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

fix runtime.js fs error #543

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+2 −17
Split
View
@@ -96,28 +96,13 @@ exports.escape = function escape(html){
exports.rethrow = function rethrow(err, filename, lineno){
if (!filename) throw err;
- var context = 3
- , str = require('fs').readFileSync(filename, 'utf8')
- , lines = str.split('\n')
- , start = Math.max(lineno - context, 0)
- , end = Math.min(lines.length, lineno + context);
-
- // Error context
- var context = lines.slice(start, end).map(function(line, i){
- var curr = i + start + 1;
- return (curr == lineno ? ' > ' : ' ')
- + curr
- + '| '
- + line;
- }).join('\n');
-
// Alter exception message
err.path = filename;
err.message = (filename || 'Jade') + ':' + lineno
- + '\n' + context + '\n\n' + err.message;
+ + '\n\n' + err.message;
throw err;
};
return exports;
-})({});
+})({});