# Class ExceptionCommand

java.lang.Object
it.polimi.ingsw.is25am31.network.socket.serverClientMessages.ExceptionCommand

All Implemented Interfaces:
  `ServerClientCommand`, `Serializable`

public class ExceptionCommand extends Object implements ServerClientCommand, Serializable
Represents a command sent from the server to the client to communicate an exception that occurred on the server-side.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExceptionCommand(Exception exception)`
  Constructs a new `ExceptionCommand`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(SocketClient client)`
  Executes the command on the `SocketClient`, instructing it to re-throw the received exception.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ExceptionCommand

    public ExceptionCommand(Exception exception)
    Constructs a new `ExceptionCommand`.
    Parameters:
      `exception` - The `Exception` object that occurred on the server.

- ## Method Details

  - ### execute

    public void execute(SocketClient client) throws Exception
    Executes the command on the `SocketClient`, instructing it to re-throw the received exception. This propagates the server-side error to the client's execution context, allowing the client to handle it appropriately.
    Specified by:
      `execute` in interface `ServerClientCommand`
    Parameters:
      `client` - The `SocketClient` instance on which the command will be executed.
    Throws:
      `Exception` - the exception that was received from the server.