Server: added stack info to logs for rollback error;

This commit is contained in:
Oleg Agafonov 2021-09-05 22:25:42 +04:00
parent 58566d2a7c
commit b739694c93
2 changed files with 8 additions and 0 deletions

View file

@ -1547,6 +1547,10 @@ public abstract class GameImpl implements Game {
}
this.fireErrorEvent("Game exception occurred: ", ex);
// stack info
String info = this.getStack().stream().map(MageObject::toString).collect(Collectors.joining("\n"));
logger.info(String.format("\nStack before error %d: \n%s\n", this.getStack().size(), info));
// rollback game to prev state
GameState restoredState = restoreState(rollbackBookmark, "Game exception: " + ex.getMessage());
rollbackBookmark = 0;

View file

@ -738,4 +738,8 @@ public class StackAbility extends StackObjectImpl implements Ability {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public String toString() {
return this.name;
}
}