Skip to content

Commit

Permalink
Server: added stack info to logs for rollback error;
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Sep 5, 2021
1 parent 58566d2 commit b739694
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Mage/src/main/java/mage/game/GameImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,10 @@ public void playPriority(UUID activePlayerId, boolean resuming) {
}
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;
Expand Down
4 changes: 4 additions & 0 deletions Mage/src/main/java/mage/game/stack/StackAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,4 +738,8 @@ public AbilityImpl setIdentifier(MageIdentifier identifier) {
throw new UnsupportedOperationException("Not supported.");
}

@Override
public String toString() {
return this.name;
}
}

0 comments on commit b739694

Please sign in to comment.