Class ErrorMessage


  • public class ErrorMessage
    extends ObjectMessage
    The message sent when an error occurs.
    • Constructor Detail

      • ErrorMessage

        public ErrorMessage​(StringTemplate template,
                            java.lang.String message)
        Create a new ErrorMessage with the given template and optional message.
        Parameters:
        template - The StringTemplate to send.
        message - An optional non-i18n message.
      • ErrorMessage

        public ErrorMessage​(StringTemplate template)
        Create a new ErrorMessage with the given template
        Parameters:
        template - The StringTemplate to send.
      • ErrorMessage

        public ErrorMessage​(java.lang.String message)
        Create a new ErrorMessage with the standard client error template and given message.
        Parameters:
        message - The message.
      • ErrorMessage

        public ErrorMessage​(java.lang.Exception ex)
        Create a new ErrorMessage from an exception with the standard client error template as the fallback.
        Parameters:
        ex - The Exception to use.
      • ErrorMessage

        public ErrorMessage​(java.lang.String key,
                            java.lang.Exception ex)
        Create a new ErrorMessage from an exception using a template key that expects a %message% parameter.
        Parameters:
        key - The template key.
        ex - The Exception to extract a message from.
      • ErrorMessage

        public ErrorMessage​(Game game,
                            FreeColXMLReader xr)
                     throws javax.xml.stream.XMLStreamException
        Create a new ErrorMessage from a stream.
        Parameters:
        game - The Game this message belongs to.
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
    • Method Detail

      • getTemplate

        private StringTemplate getTemplate()
        Get the template.
        Returns:
        The template.
      • getMessage

        private java.lang.String getMessage()
        Get the non-i18n message.
        Returns:
        The message.
      • aiHandler

        public void aiHandler​(FreeColServer freeColServer,
                              AIPlayer aiPlayer)
        AI-side handler for this message. AI handlers always return null. FIXME: One day the FreeColServer should devolve to AIMain.
        Overrides:
        aiHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        aiPlayer - The AIPlayer the message was sent to.
      • clientHandler

        public void clientHandler​(FreeColClient freeColClient)
        Client-side handler for this message. Client handlers always return null.
        Overrides:
        clientHandler in class TrivialMessage
        Parameters:
        freeColClient - The FreeColClient to handle this message.