Closed Bug 412755 Opened 16 years ago Closed 16 years ago

Provide better error message when a function is not found

Categories

(Rhino Graveyard :: Core, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mguillemot, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071204 Ubuntu/7.10 (gutsy) Firefox/2.0.0.11
Build Identifier: 

the error messages for 
  var a = {}; a.foo() // -> Cannot find function foo.
and
  var a = {foo: 1}; a.foo() // -> foo is not a function, it is java.lang.Double.

don't tell on which object function foo could not be found (here [object Object] which is not that useful, but this is only an example).

Attached patch improves these error messages.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Fixed, accepting patch with some modifications:

Checking in src/org/mozilla/javascript/ScriptRuntime.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java,v  <--
ScriptRuntime.java
new revision: 1.288; previous revision: 1.287
done
Checking in src/org/mozilla/javascript/resources/Messages.properties;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/resources/Messages.properti
es,v  <--  Messages.properties
new revision: 1.85; previous revision: 1.84
done
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Thanks.

Can you explain your modifications. This would help to provide patch that better comply to Rhino "style". Particularly:
- why didn't you include the unit test?
- why did you remove the final keywords?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: