Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting - send to console! #792

Closed
Thinkscape opened this issue Apr 30, 2012 · 4 comments
Closed

Improve error reporting - send to console! #792

Thinkscape opened this issue Apr 30, 2012 · 4 comments

Comments

@Thinkscape
Copy link

I recommend that all parsing/loading/init errors in "production" to be output directly to window.console, i.e. using window.console.warn().

Background: I've lost a 2 hours trying to debug less installation. It boiled down to some typo which caused parsing error. less.js client-side script should never fail silently in default enviroment ("production") - this currently creates ambiguity (has js loaded? have less files loaded? is there a browser problem? etc.)

The only workaround I've found for quick debugging - in browser's js console type less.env = "development"; followed by less.refresh();

Reference: http://getfirebug.com/wiki/index.php/Console_API

@matthew-dean
Copy link
Member

The better and easier option might be to develop using a server-side LESS compiler. Also, like you said, you can trigger a "development" mode in-browser as well.

@Thinkscape
Copy link
Author

The whole point of less.js is to allow client-side less loading and processing (as in: development, although some sites are also using it for production).

There is nothing easier in using a server-side less compiler, especially when someone is already spending a lot of time in a js debugger (like webkit dev console or firebug), fiddling with styles and scripts.

Development mode in current version is terrible! Those huge error messages are destructive to DOM, AFAIR they attach to for some reason and there is no easy way to get rid of them. All extensions, analyzers and devel tools use window.console and Console.log() is like 6 years old :-)

I don't even want to mention LESS watch mode which is used for exactly this purpose - to make reloading and testing less templates faster. But I don't see errors unless I enable devel mode which in turns destroys the whole markup.

@lukeapage
Copy link
Member

we really should default the environment to development and then we can close this.

@lukeapage
Copy link
Member

I've added an errorReporting option which can be null or "html" for the normal handling, console or a function which is called with the error object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants