Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors piping to c# #38

Closed
asadm opened this issue Jan 27, 2024 · 3 comments
Closed

Errors piping to c# #38

asadm opened this issue Jan 27, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@asadm
Copy link
Collaborator

asadm commented Jan 27, 2024

I noticed that if Unity calls some native javascript code, and that throws an error, the error doesn't propagate automatically in my C# code, so I can't wrap my own code in some try catch.
How do you guys deal with this situation?

image

@momintlh
Copy link
Collaborator

momintlh commented Jan 30, 2024

What should I do here, catch the errors on JS side and send to unity?

@SaadBazaz SaadBazaz added the bug Something isn't working label Jan 30, 2024
@SaadBazaz
Copy link
Collaborator

SaadBazaz commented Jan 30, 2024

What should I do here, catch the errors on JS side and send to unity?

That sounds reasonable. Essentially it might be cool to differentiate between a Unity error and a JavaScript error.
So an interesting idea would be to throw an Error in C# with

{
    "type": "UNCAUGHT_JAVASCRIPT_EXCEPTION",
    "message": "Uncaught exception in JavaScript library",
    "error": "<dump everything here/>"
}

@SaadBazaz
Copy link
Collaborator

Shifted to #40 for further discussion, as the OP's Issue has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants