-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
There is no way to property deal with exceptions in CoreViewer #1268
Comments
Vivliostyle Viewer can display error messages. The relevant code is found in: vivliostyle.js/packages/viewer/src/viewmodels/viewer.ts Lines 119 to 121 in 8667886
You may write similar code in your program that uses the CoreViewer. e.g., coreViewer.addListener("error", (payload) => {
alert(payload.content.error);
}); |
Thank you. Is it guaranteed, that Vivliostyle stops pagination with the first error that occurs? Or can there be more than one error? |
There can be more than one error. However, "error" indicates something unexpected, e.g., "TypeError: Cannot read properties of undefined" is caused by program bugs and after such an exception occurs, normal processing is not expected to continue. On the other hand, "warn" (you can use |
Thanks to this issue, I realized that the error handling in vivliostyle, especially on vivliostyle-print, needs to be improved, so I made the following pull requests: |
I am using the CoreViewer.loadDocument API for loading documents and I use the addListener API to get notified when loading has finished. When because of any reason Vivliostyle is throwing an exception during pagination, there is no way for me to detect this, as Vivliostyle simply catches and logs the exception but the listener is not notified.
The text was updated successfully, but these errors were encountered: