Provide better error message when a function is not found

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Marc, Unassigned)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
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.
(Reporter)

Comment 1

10 years ago
Created attachment 297520 [details] [diff] [review]
Patch with unit test improving the error messages

Comment 2

10 years ago
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
Last Resolved: 10 years ago
Resolution: --- → FIXED
(Reporter)

Comment 3

10 years ago
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.