Skip to content

Commit

Permalink
✨ Add Renderer#handleError() method
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Feb 4, 2024
1 parent f65b489 commit 00ed0e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Actually update the `hawkejs.scene.exposed` values after receiving new data from the server
* Fix custom-element render issue with overlaying variable instances
* Fix setting `value` not working server-side on `<textarea>` elements
* Add `Renderer#handleError()` method

## 2.3.15 (2023-11-27)

Expand Down
21 changes: 21 additions & 0 deletions lib/core/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,27 @@ Renderer.setMethod(function _prepareClone(wm, custom_method) {

});

/**
* Handle an error
*
* @author Jelle De Loecker <[email protected]>
* @since 2.3.16
* @version 2.3.16
*
* @return {string}
*/
Renderer.setMethod(function handleError(error) {

if (!error) {
error = new Error('Unknown error');
}

let template_name = this.current_template?.name || this.errName;
let line_nr = this.errLine;

return this.hawkejs.handleError(this, template_name, line_nr, error);
});

/**
* Flag this renderer (and all its children) as finished
*
Expand Down

0 comments on commit 00ed0e8

Please sign in to comment.