Fix errors

This commit is contained in:
Anton Vakhrushev 2020-04-03 13:04:08 +03:00
parent 0a6d08a105
commit 694a3fffb4
3 changed files with 10 additions and 3 deletions

View File

@ -11,6 +11,7 @@ export class CheckBuildingRemainingTimeAction extends ActionController {
const remainingSeconds = Number(timer.attr('value'));
if (remainingSeconds > 0) {
throw new BuildingQueueFullError(
task.id,
remainingSeconds + 1,
'Building queue is full'
);

View File

@ -11,7 +11,11 @@ export class UpgradeBuildingAction extends ActionController {
);
if (btn.length !== 1) {
throw new TryLaterError(5 * 60, 'No upgrade button, try later');
throw new TryLaterError(
task.id,
15 * 60,
'No upgrade button, try later'
);
}
btn.trigger('click');

View File

@ -21,7 +21,8 @@ export class AbortTaskError extends Error {
export class TryLaterError extends Error {
readonly seconds: number;
readonly taskId: TaskId;
constructor(seconds: number, taskId: TaskId, msg: string = '') {
constructor(taskId: TaskId, seconds: number, msg: string = '') {
super(msg);
this.taskId = taskId;
this.seconds = seconds;
@ -32,7 +33,8 @@ export class TryLaterError extends Error {
export class BuildingQueueFullError extends Error {
readonly seconds: number;
readonly taskId: TaskId;
constructor(seconds: number, taskId: TaskId, msg: string = '') {
constructor(taskId: TaskId, seconds: number, msg: string = '') {
super(msg);
this.taskId = taskId;
this.seconds = seconds;