dpinol / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

Poor error message when parameters are not supplied #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. hello world example
2. do not supply required parameters.
3. poor/confusing error message "opt_data is undefined
. simple.js
Line 10"

What is the expected output? What do you see instead?

I expect to see "missing required parameter 'name'"

What version of the product are you using? On what operating system?

latest 

Please provide any additional information below.

Original issue reported on code.google.com by transpar...@gmail.com on 20 Jun 2011 at 1:04

GoogleCodeExporter commented 8 years ago
This is just the default JS error from running the generated JS code. We don't 
feel it's a good idea to generate extra JS code just to modify the default JS 
error message to some other message.

Original comment by kai.hu...@gmail.com on 30 Aug 2011 at 7:30

GoogleCodeExporter commented 8 years ago
Perhaps. However consider this:

1) opt_data is not in the source javascript (only the generated js)
2) compiler user has no idea what opt_data is. Nor any clue on where to start 
looking.
3) the source javascript may handle missing parameters. However, because of 
"some comment", this error appears.
4) if the error appears when using the compiler and disappears when not using 
the compiler --> the compiler caused a bug.

You may disagree with the last point. However, from the perception of a new 
compiler user the natural conclusion is the compiler is problematic. Consider 
the purpose of a compiler is to increase the safety, clarity of code. This 
unexplained error message does the opposite. 

The compiler should point the finger of blame so that it doesn't get the blame.

Original comment by transpar...@gmail.com on 30 Aug 2011 at 9:39

GoogleCodeExporter commented 8 years ago
You do make good points! We'll keep these in mind, especially if we get more 
complaints relating to this same problem.

Original comment by kai.hu...@gmail.com on 30 Aug 2011 at 10:07

GoogleCodeExporter commented 8 years ago
thx. Appreciate being heard. 

We are planning on using the compiler and I would like to minimize the amount 
of institutional knowledge/training new devs need.

Original comment by transpar...@gmail.com on 30 Aug 2011 at 10:11