Subj : Exceptions/Errors/Line Numbers To : netscape.public.mozilla.jseng From : Brian Barnes Date : Mon Jun 27 2005 12:45 am --Apple-Mail-2--197182267 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed A quick problem. In my C code (which represents functions on an object), if an argument is wrong, I throw an exception. Right now, I do this: JS_SetPendingException(cx,script_string_to_value("my error text")); script_string_to_value is just a wrapper to turn the string into a JSVAL. This works fine. When reacting to the error (in C), I get the pending exception, check if it's a string, then use the string. If it's not a string, then JS itself throws and exception, and I can call: report=JS_ErrorFromException(cx,errval); And get the report. The problem: When I make an exception, I don't get the line numbers and other information. I want to be able (in C) to construct a exception like the engine itself does, so I can have the line numbers where it occurred. Calling: JS_ReportError(cx,"my error text"); Doesn't work, as it's not an exception (maybe this is my problem, and I don't understand this correctly.) So, what solutions do I have? [>] Brian --Apple-Mail-2--197182267 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 A quick problem.=A0 In my C code = (which represents functions on an object), if an argument is wrong, I = throw an exception.=A0 Right now, I do this:

JS_SetPendingException(cx,script_string_to_value("my error = text"));

script_string_t= o_value is just a wrapper to turn the string into a JSVAL.

This works fine.=A0 When = reacting to the error (in C), I get the pending exception, check if it's = a string, then use the string.=A0 If it's not a string, then JS itself = throws and exception, and I can call:

report=3DJS_ErrorFromException(cx,errval);
=
And get the = report.

The = problem:=A0 When I make an exception, I don't get the line numbers and = other information.=A0 I want to be able (in C) to construct a exception = like the engine itself does, so I can have the line numbers where it = occurred.=A0 Calling:

JS_ReportError(cx,"my error = text");

Doesn't work, as it's not = an exception (maybe this is my problem, and I don't understand this = correctly.)=A0 So, what solutions do I have?

[>] = Brian
= --Apple-Mail-2--197182267-- .