diff --git a/js/battle.js b/js/battle.js
index d43569cc8..4e2b86e93 100644
--- a/js/battle.js
+++ b/js/battle.js
@@ -4184,6 +4184,7 @@ function Battle(frame, logFrame, noPreload) {
default:
self.logConsole('Unknown minor: ' + args[0]);
+ if (self.errorCallback) self.errorCallback(self);
break;
}
}
@@ -4690,6 +4691,7 @@ function Battle(frame, logFrame, noPreload) {
default:
self.logConsole('unknown command: ' + args[0]);
self.log('
Unknown command: ' + Tools.escapeHTML(args[0]) + '
');
+ if (self.errorCallback) self.errorCallback(self);
break;
}
};
@@ -4751,6 +4753,7 @@ function Battle(frame, logFrame, noPreload) {
} else {
self.log('Error: ' + Tools.escapeHTML(''+e) + '
', preempt);
}
+ if (self.errorCallback) self.errorCallback(self);
}
} else {
self.log('' + Tools.escapeHTML(str) + '
', preempt);
@@ -4972,6 +4975,7 @@ function Battle(frame, logFrame, noPreload) {
this.stagnateCallback = null;
this.endCallback = null;
this.customCallback = null;
+ this.errorCallback = null;
// external
this.resumeButton = this.play;