Skip to content

Catch top-level errors in embedded js engine #8

@nick-thompson

Description

@nick-thompson

Similar to #7, this issue is in the spirit of making sure we're resilient against crashes and instead relay helpful information to the user to facilitate a nice dev experience.

In PluginProcessor, anywhere we try to evaluate user code in the jsContext we should try/catch to prevent uncaught errors or syntax errors from crashing the native binary. I'm thinking that the general gist should be: if we fall into that catch block for any relevant jsContext.evaluate, serialize a helpful error message and get it to the editor so the user can see the error logged in the frontend dev console.

The dispatching of those error messages will follow the pattern from this commit: e69797f, except that with this PR I think we can improve the logging: any time we try to log to the editor, we should put the message into a queue. Then, if the editor exists, drain the queue. If the editor does not exist, we leave the queue as-is, and on any subsequent createEditor call we should drain the queue once the editor is open. This way we prevent losing any messages if the editor happens to be closed at the time of the log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions