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

[Question] Is there any way to get the parser errors other than from console log #3159

Closed
sathyanarayananaCES opened this issue Nov 26, 2020 · 1 comment

Comments

@sathyanarayananaCES
Copy link

I am using the latest GrapesJS (v0.16.27). As per the fix for the issue, (#2029) the exception has been caught and logged into the console.

Is there any way where we can get to know about the errors other than from console log?

Something similar to asset:upload:error, if we have parse:error, it would be helpful to handle the errors in a custom way. If we already have a way to handle this, please let me know.

@artf
Copy link
Member

artf commented Nov 26, 2020

Usually, the error doesn't come from the parser but from the creation of the DOM (eg. the editor creates the element by using setAttribute). You can catch the editor's errors by listening to the log event

editor.on('log:error', (err) => console.log('error from the editor', err))

Here, for example, you can put your logic (eg. by reading the error) and show the appropriate response

@artf artf closed this as completed Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants