Skip to content
Browse files

Merge pull request #4 from danro/master

Improve error handling to show tooltips instead of node errors
  • Loading branch information...
2 parents f487f94 + b1074cc commit 542dbfa5eddc2bfca975d61c789e84f946e22bd4 @creationix committed Dec 22, 2011
Showing with 16 additions and 3 deletions.
  1. +16 −3 Commands/Save to CSS.tmCommand
View
19 Commands/Save to CSS.tmCommand
@@ -14,10 +14,23 @@ var less_file = process.env.TM_FILEPATH;
var css_file = less_file.replace(/\.less$/, ".css");
var input = fs.readFileSync(less_file, 'utf8');
-less.render(input, function (e, css) {
- if (e) { throw e; }
- fs.writeFileSync(css_file, css);
+try {
+ less.render(input, {}, function (e, css) {
+ if (e) { throw e; }
+ fs.writeFileSync(css_file, css);
+ });
+}
+catch (err) {
+ logError(err);
+}
+
+process.on('uncaughtException', function (err) {
+ logError(err);
});
+
+function logError (err) {
+ console.log("LESS Error:\n" + err.message + "\nLine: " + err.line);
+}
</string>
<key>input</key>
<string>document</string>

0 comments on commit 542dbfa

Please sign in to comment.
Something went wrong with that request. Please try again.