J2V8
J2V8 copied to clipboard
Expose the javascript line number through a java API
When in Java from within a Javascript entry-point, it is sometimes useful to know the javascript line number, for debug purposes for example. For example, if an exception is thrown through java, knowing which javascript line number called the java method is useful for debugging.
A nice interface for this may be simply to maintain a FILE and LINE variables as part of the javascript context. That way java may simply need to extract these variable values in order to report on them.
@deltagreen please check that unit test: https://github.com/eclipsesource/J2V8/blob/master/src/test/java/com/eclipsesource/v8/V8Test.java#L1905 You can access the full stack trace of JavaScript exception in Java. What is your use case?
I am not within the context of an exception.
I am into a java hook called from javascript, and run normally, yet I want to report what is the javascript context (the line number) into my logs.
On Tue, Nov 12, 2019 at 5:52 PM Elmi Ahmadov [email protected] wrote:
@deltagreen https://github.com/deltagreen please check that unit test: https://github.com/eclipsesource/J2V8/blob/master/src/test/java/com/eclipsesource/v8/V8Test.java#L1905 You can access the full stack trace of JavaScript exception in Java. What is your use case?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eclipsesource/J2V8/issues/483?email_source=notifications&email_token=ACD5TUWDPPN3F5BYV3IN54TQTMQSBA5CNFSM4JGQT2T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOED4CH7Y#issuecomment-553133055, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD5TUQNVEQIPMG22ITCYEDQTMQSBANCNFSM4JGQT2TQ .
I see your point now. I tagged this issue as a new feature
request. I'll take a look as soon as I'd have time.
Best of luck, thank you.
On Tue, Nov 12, 2019 at 6:12 PM Elmi Ahmadov [email protected] wrote:
I see your point now. I tagged this issue as a new feature request. I'll take a look as soon as I'd have time.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eclipsesource/J2V8/issues/483?email_source=notifications&email_token=ACD5TUU25GOYCMQNNR26SILQTMS3BA5CNFSM4JGQT2T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOED4EC3Y#issuecomment-553140591, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD5TUWFTXIACD2JQS36H2LQTMS3BANCNFSM4JGQT2TQ .
Hi, is there any news about this feature request? It is really useful.
No sign of any movement from here so far.
On Tue, Oct 20, 2020 at 10:22 AM Abi2737 [email protected] wrote:
Hi, is there any news about this feature request? It is really useful.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eclipsesource/J2V8/issues/483#issuecomment-712889965, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD5TUQNJSQEBZVU53XGD3DSLWMJBANCNFSM4JGQT2TQ .
Thank you for your quick reply.
It is not only for debug purpose. For example, I've implemented the console
object registering java methods for .log
, .error
, etc functions, but in Android, if I want to instantiate a ConsoleMessage
object, I need the message, sourceId, lineNumber and the message level, see here
So a FILE and LINE variables as part of the javascript context or something similar would be extremely helpful.
Thank you!