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 messages throughout the framework #1041

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

Comments

Projects
None yet
6 participants
@IgorMinar
Member

IgorMinar commented Jun 12, 2012

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

This comment has been minimized.

Show comment
Hide comment
@ProLoser

ProLoser Nov 8, 2012

Contributor

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)

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

This comment has been minimized.

Show comment
Hide comment
@abilashs90

abilashs90 Jul 16, 2013

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

abilashs90 commented Jul 16, 2013

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

@petebacondarwin

This comment has been minimized.

Show comment
Hide comment
@petebacondarwin

petebacondarwin Jul 16, 2013

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
.

Member

petebacondarwin commented Jul 16, 2013

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

This comment has been minimized.

Show comment
Hide comment
@kfgodel

kfgodel 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.

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

This comment has been minimized.

Show comment
Hide comment
@btford

btford Dec 9, 2013

Contributor

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!

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