mirror of
https://github.com/correl/mage.git
synced 2025-04-11 09:11:12 -09:00
Fixed Issue#122: Check of deck and game type during creating a new table doesn't show a qualified error message
This commit is contained in:
parent
2b6e87885a
commit
2c652770fb
2 changed files with 11 additions and 1 deletions
Mage.Client/src/main/java/mage/client/dialog
Mage.Common/src/mage/remote
|
@ -398,7 +398,8 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
private void handleError(Exception ex) {
|
||||
logger.fatal("Error loading deck", ex);
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
//JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
MageFrame.getInstance().showErrorDialog("Error loading deck.", ex.getMessage());
|
||||
}
|
||||
|
||||
public void showDialog(UUID roomId) {
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.remote;
|
|||
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.InvalidDeckException;
|
||||
import mage.constants.Constants.SessionState;
|
||||
import mage.game.GameException;
|
||||
import mage.game.match.MatchOptions;
|
||||
|
@ -404,6 +405,8 @@ public class SessionImpl implements Session {
|
|||
try {
|
||||
if (isConnected())
|
||||
return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList);
|
||||
} catch (InvalidDeckException iex) {
|
||||
handleInvalidDeckException(iex);
|
||||
} catch (GameException ex) {
|
||||
handleGameException(ex);
|
||||
} catch (MageException ex) {
|
||||
|
@ -1057,6 +1060,12 @@ public class SessionImpl implements Session {
|
|||
|
||||
private void handleMageException(MageException ex) {
|
||||
logger.fatal("Server error", ex);
|
||||
client.showError(ex.getMessage());
|
||||
}
|
||||
|
||||
private void handleInvalidDeckException(InvalidDeckException iex) {
|
||||
logger.warn(iex.getMessage() + "\n" + iex.getInvalid());
|
||||
client.showError(iex.getMessage() + "\n" + iex.getInvalid());
|
||||
}
|
||||
|
||||
private void handleGameException(GameException ex) {
|
||||
|
|
Loading…
Add table
Reference in a new issue