TypeError: I could use some explanation
Jim Laskey (Oracle)
james.laskey at oracle.com
Wed Dec 16 14:07:41 UTC 2015
How is t4_context used in the function? IE., what does line 30 look like?
— Jim
> On Dec 16, 2015, at 10:01 AM, Kasmeroglu, Daniel <daniel.kasmeroglu at aperto.com> wrote:
>
> Hi there,
>
> First of all: thanks for the great work with Nashorn.
> Unfortunately I'm currently a little bit stuck as I don't get what I'm
> doing wrong here.
> Here's a simple code snippet that explains what I'm doing:
>
> --<8--
> ScriptEngine engine = ...
> Map<String, Object> context = ...
> engine.put("t4_context", context);
> engine.eval("t4(t4_context);");
> --8>--
>
> The variable 't4' is a compiled template generated through Handlebars
> (so it's a function taking a hash).
> Unfortunately I don't get it running as there's the following complain:
>
> --<8--
> Caused by: <function>:30 TypeError: {assets=dodo} is not an Object
> --8>--
>
> It's clear to me that the issue is caused since the java object
> 'context' isn't an instance of 'ScriptObject'. However it isn't clear to
> me why this happens.
>
> It would be nice to give me a hint of what I'm doing wrong or to point
> me to some helpful documentation.
>
> Thanks in advance.
>
>
> --
> Dipl.-Inform. Daniel Kasmeroglu, Java Developer Advanced
>
> Email daniel.kasmeroglu at aperto.de
> Phone +49 30 283921-381
> Fax +49 30 283921-29
>
> Aperto AG - In der Pianofabrik
> Chausseestraße 5, D-10115 Berlin-Mitte
> http://www.aperto.de
> http://www.facebook.com/aperto
> https://www.xing.com/companies/apertoag
>
> HRB 77049, AG Berlin Charlottenburg
> Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen,
> Daniel Simon
> Aufsichtsrat: Bernd Hardes (Vorsitzender)
>
>
More information about the nashorn-dev
mailing list