-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add errorCallback config option to VivliostylePrint/printHTML()
So far VivliostylePrint has no way to handle errors. This commit adds a new config option `errorCallback` to VivliostylePrint/`printHTML()` to handle errors. Usage example: ```ts printHTML(htmlDoc, { errorCallback: (msg) => { alert(msg); }, }); ``` This commit also fixes the following issues on error handling: - `Payload.content` type should be `ErrorInfo` instead of `string`. - `loadDocument()` and `loadPublication()` in CoreViewer needed to fix the "No URL specified" error handling. - `Logging.logger.addListener(level, listener)` used to push a listener to an array per level so that multiple listeners can be registered for the same level. However, that was problematic because the `Logging.logger` is a singleton instance but the CoreViewer instance is created each time `printHTML()` is called, and new listeners are added each time without removing the old ones, causing the listeners to be duplicated. This commit changes the `addListener` method to replace the listener for the level if it already exists.
- Loading branch information
1 parent
b0eebea
commit 65c5a5f
Showing
3 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters