Improve error messages throughout the framework #1041

Closed
IgorMinar opened this Issue Jun 12, 2012 · 5 comments

Projects

None yet

6 participants

@IgorMinar
Member

Our error messages are very inconsistent, often don't provide info info to debug the problem (because more info == more bytes) and at the same time take up a big chuck of our byte payload anyway.

How about we do the following:

  • introduce string interpolation so that our error messages can be easier to write:
    before: throw Error("Your " + foo + " did something stupid in " + bar))
    after: throw InterpolatedError("Your {foo} did something stupid in {bar}", foo, bar)

  • go through all error messages, unify them and ensure that they provide enough info for debugging purposes

  • introduce a new compilation pass (with closure compiler or uglify) that will either completely remove (where it makes sense) error messages for the production build or replace them with error codes:
    before: throw Error("Your " + foo + " did something stupid in " + bar))
    after in min.js build: throw Error('NG-323',f,b)

    we can then build a error code table to decipher production errors.

@ProLoser
Contributor
ProLoser commented Nov 8, 2012

One of the things that I thought might help was logging the DOM element that causes some of the errors (such as when used in directives)

@abilashs90

Especially the $digest errors! Sometimes your are clueless as to what's happening!

@petebacondarwin
Member

See the minErr implementation in master.

On 16 July 2013 04:00, abilashs90 notifications@github.com wrote:

Especially the $digest errors! Sometimes your are clueless as to what's
happening!


Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/1041#issuecomment-21018437
.

@kfgodel
kfgodel commented Dec 4, 2013

If you add error codes, please also maintain text description on every situation. Getting only a code it's a very painful.
Please consider as error and log any problem interpreting configuration files (services.js, controllers.js, etc). Sometimes a typo makes them useless and the JS console is empty.

@btford
Contributor
btford commented Dec 9, 2013

minErr has since implemented most of this. If there's some specific issue where a better error would be more helpful, feel free to file a new issue/PR for it. Thanks!

@btford btford closed this Dec 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment