"Error executing the script" extended info?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

"Error executing the script" extended info?

Mihai Dobrescu
Hello,

Is there a builtin way to get more info than basic error message "Error executing the script"?
I look to get the name of the failed function at least.

Thanks.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Boris Zbarsky
On 2/22/16 4:23 AM, [hidden email] wrote:
> Is there a builtin way to get more info than basic error message "Error executing the script"?

Where are you getting that message from?

-Boris
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Mihai Dobrescu

That is a custom message in case of returning false from JS::Evaluate (compiled from "How to embed the JavaScript engine" and some other articles on the Inrternet related to SpiderMonkey). This is not enough, it should be possible to set some information related to which js native function crashed and returned false, for example.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Boris Zbarsky
On 2/22/16 10:03 AM, [hidden email] wrote:
> That is a custom message in case of returning false from JS::Evaluate

OK, so if JS::Evaluate returned false, then either your error reporter
got called or there's a pending exception on the JSContext, right?

> This is not enough, it should be possible to set some information related to which js native function crashed and returned false, for example.

When you say "js native function", do you mean a JSNative, or do you
mean a scripted function?

-Boris

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Mihai Dobrescu
Where to read how to get the pending exception?
Yes, JSNative.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Mihai Dobrescu
In reply to this post by Boris Zbarsky
Where to read how to get the pending exception?
Yes, JSNative.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Terrence Cole-3
You want JS_IsExceptionPending[1] and JS_GetPendingException[2].

1-
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_IsExceptionPending
2-
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_GetPendingException

On Mon, Feb 22, 2016 at 8:48 AM, <[hidden email]> wrote:

> Where to read how to get the pending exception?
> Yes, JSNative.
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Boris Zbarsky
In reply to this post by Mihai Dobrescu
On 2/22/16 11:48 AM, [hidden email] wrote:
> Where to read how to get the pending exception?

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_GetPendingException

There's also JS::ExceptionStackOrNull which will give you a stack trace
representation if there is one attached to the exception and then you
can use JS::BuildStackString to get the stack as a JSString.

Or you could just try JS_GetProperty for the "stack" property on the
exception object, of course, if the exception value is an object.  That
depends on your situation and whether you have to worry about people
throwing random stuff with untrusted getters on it.

-Boris
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Mihai Dobrescu
In reply to this post by Mihai Dobrescu
Thank you both, I'll study these right now!
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Mihai Dobrescu
In reply to this post by Mihai Dobrescu
If I want localization, using a similar file to js.msg, what is the path to get English and other language available? Should there be a binary compiled for each language? Are there js.msg files for different languages already?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: "Error executing the script" extended info?

Terrence Cole-3
Unfortunately, SpiderMonkey does not know how to localize error messages. I
think you'd either have to write a patch to add gettext support in
SpiderMonkey or hack up a local copy of js.msg.

On Tue, Feb 23, 2016 at 10:54 AM, <[hidden email]> wrote:

> If I want localization, using a similar file to js.msg, what is the path
> to get English and other language available? Should there be a binary
> compiled for each language? Are there js.msg files for different languages
> already?
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine