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

have better error messages #443

Open
seb-odoo opened this issue Nov 6, 2019 · 6 comments
Open

have better error messages #443

seb-odoo opened this issue Nov 6, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@seb-odoo
Copy link
Contributor

seb-odoo commented Nov 6, 2019

As an example, I'm currently having this error in my console, and except the first line which gives me a hint, it doesn't help at all because all of the traceback lines are inside owl.

What I want to see is where on my code there is a crash: either a JS line number, or some hint about which template and potentially where on this template it happens.

 TypeError: "context.storeProps.computed is undefined" owl.js:3678:17
    anonymous http://127.0.0.1:8069/web/static/lib/owl/owl.js line 1572 > Function:15
    fn http://127.0.0.1:8069/web/static/lib/owl/owl.js:1450
    render http://127.0.0.1:8069/web/static/lib/owl/owl.js:1499
    render http://127.0.0.1:8069/web/static/lib/owl/owl.js:3881
    __render http://127.0.0.1:8069/web/static/lib/owl/owl.js:3552
    __prepareAndRender http://127.0.0.1:8069/web/static/lib/owl/owl.js:3542
    errorHandler http://127.0.0.1:8069/web/static/lib/owl/owl.js:3678
    __render http://127.0.0.1:8069/web/static/lib/owl/owl.js:3560
    __prepareAndRender http://127.0.0.1:8069/web/static/lib/owl/owl.js:3542
@ged-odoo ged-odoo self-assigned this Nov 6, 2019
@seb-odoo
Copy link
Contributor Author

Another problematic error:

Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
    at QWeb.eval (eval at _compile (owl.js:1567), <anonymous>:50:72)
    at QWeb.fn (owl.js:1445)
    at QWeb.render (owl.js:1494)
    at Object.__owl__.renderFn (owl.js:4086)
    at MessageList.__render (owl.js:3773)
    at MessageList.__prepareAndRender (owl.js:3763)

This error is a little bit better out of the box because it tells on the render of which component it happened. But of course the problematic line on the template would be better here too.

@ged-odoo
Copy link
Contributor

fun fact: i think that your second error is a little bit better because it was obtained in Chrome, and your first error comes from firefox...

This is actually quite annoying, it is difficult to work with different browsers. There are no good way to introspect an error, so we have to try to parse the message string or the stack.

@seb-odoo
Copy link
Contributor Author

Different browsers indeed.

@ged-odoo
Copy link
Contributor

well, after working on this for a time, I can say that handling/introspecting errors in JS is really really really bad.

  • firefox has a lineNumber attribute, other browsers don't
  • we need to parse the stack, which is not standardized, to extract a line number
  • chrome and firefox dev tools are confused when breaking on errors that occur in a compiled piece of code: one of them display the breakpoint 2 lines higher than it should, the other 2 lines lower...
  • modifying name/message properties of an error kind of work, except that firefox does not display the updated property in the console. Oh, and Chrome does not display the updated name/property if we are in a debugger/dev tools open, but it does use them in the console if the dev tools are closed...
  • nodejs has still different numbers, and it is not compatible with the other

All of that together, I really do not see how I can provide a decent error in all cases... So, i will stop working on this for now, unless someone has an idea...

@ged-odoo ged-odoo added the enhancement New feature or request label Nov 15, 2019
@aab-odoo
Copy link
Contributor

aab-odoo commented Dec 4, 2019

This is probably a terrible idea, but maybe keep variables names when generating variables in compiled code to help dev finding the issue

@aab-odoo
Copy link
Contributor

aab-odoo commented Dec 4, 2019

maybe also add (in dev mode) a comment of the xml line we are processing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants