Skip to content
Browse files

Improve error handling to show tooltips instead of node errors

  • Loading branch information...
1 parent f487f94 commit b1074cc255a0237f97e4bd3ae3ed3efe42de47c3 @danro danro committed Dec 21, 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 b1074cc

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