Add error handling in index

This commit is contained in:
Anton Vakhrushev 2020-04-29 18:53:41 +03:00
parent 5cb1f2b879
commit b9d6ebc45d

View File

@ -5,6 +5,7 @@ import { Executor } from './Executor';
import { ControlPanel } from './ControlPanel';
import TxtVersion from '!!raw-loader!./version.txt';
function main() {
const logger = new ConsoleLogger('Travian');
logger.log('TRAVIAN AUTOMATION', TxtVersion);
@ -22,3 +23,10 @@ if (modeDetector.isAuto()) {
const controlPanel = new ControlPanel(TxtVersion, scheduler);
controlPanel.run();
}
}
try {
main();
} catch (e) {
setTimeout(() => location.reload(), 5000);
}