On 2014/06/05 11:44:03, vsevik wrote:
> Now that I looked closer at this API, I see (if I'm not mistaken) two ways
to
> get the script name of where the exception was thrown:
> - Through the script in the Message object, like exposed in this CL.
> - Through the stack trace in the Message object. The top most function in
the
> stack trace can be used for Function::GetScriptOrigin, which gives you a
> ScriptOrigin object, containing the script name or URL.
>
> I wonder if we even need the first option. If not, we could even rip out the
> script from the Message object altogether and just always use the second
option
> to get to the script.

I agree that it would be great to remove redundant data from the Message
object,
but I think there is a problem here.
As I mentioned in the e-mail thread previously we are working on adding better
syntax error handling here.
In case of SyntaxError the stack trace is either empty or has an eval() call
on
its topmost frame.
The script where the original error happened and the position of the error in this script is therefore not accessible from the stack trace which is why we
need to have it separately.

Alright. Nevertheless, wouldn't it be nicer if the new method we expose here is
similar to Function::GetScriptOrigin, that gives a ScriptOrigin object that
contains all information including line numbers etc, so that we can phase out
the corresponding Message::Get* and Message::IsSharedCrossOrigin? I see that
ScriptOrigin doesn't have an equivalent to Message::Get{Start,End}Position and
Message::GetEndColumn, but the former is not used anywhere afaict, and the
latter can be added to ScriptOrigin. That would be more consistent IMO.

https://codereview.chromium.org/265593002/

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to