Add an error callback to battle.js