Skip to content

Commit 8c74bc7

Browse files
committed
Put try/catch directly around this.editor.options.onNodeName(...) (see #617)
1 parent 1e29d2a commit 8c74bc7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/js/Node.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4468,25 +4468,25 @@ Node.prototype._escapeJSON = function (text) {
44684468
* @private
44694469
*/
44704470
Node.prototype.updateNodeName = function () {
4471-
try {
4472-
var count = this.childs ? this.childs.length : 0;
4473-
var nodeName;
4474-
if (this.type === 'object' || this.type === 'array') {
4475-
if (this.editor.options.onNodeName) {
4471+
var count = this.childs ? this.childs.length : 0;
4472+
var nodeName;
4473+
if (this.type === 'object' || this.type === 'array') {
4474+
if (this.editor.options.onNodeName) {
4475+
try {
44764476
nodeName = this.editor.options.onNodeName({
44774477
path: this.getPath(),
44784478
size: count,
44794479
type: this.type
44804480
});
44814481
}
4482-
4483-
this.dom.value.innerHTML = (this.type === 'object')
4484-
? '{' + (nodeName || count) + '}'
4485-
: '[' + (nodeName || count) + ']';
4482+
catch (err) {
4483+
console.error('Error in onNodeName callback: ', err);
4484+
}
44864485
}
4487-
}
4488-
catch (err) {
4489-
console.error('Error in onNodeName callback: ', err);
4486+
4487+
this.dom.value.innerHTML = (this.type === 'object')
4488+
? ('{' + (nodeName || count) + '}')
4489+
: ('[' + (nodeName || count) + ']');
44904490
}
44914491
}
44924492

0 commit comments

Comments
 (0)