Class SFSErrorCodes


  • public class SFSErrorCodes
    extends java.lang.Object
    The SFSErrorCodes class provides a mean of translation between server error codes and their relative error messages.

    Error messages are provided by default in the English language but they can be localized and substituted in any other language. The error messages contain special placeholders that are processed at runtime and substituted with runtime data. They are in the form of a number enclosed in curly brackets such as: {0}, {1}, etc. Please make sure you maintain these placeholders while translating the messages.

    For more informations please check this link: http://docs2x.smartfoxserver.com/AdvancedTopics/client-error-messages
    • Constructor Summary

      Constructors 
      Constructor Description
      SFSErrorCodes()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getErrorMessage​(short code, java.lang.Object[] args)
      * API internal usage only *
      static void setErrorMessage​(short code, java.lang.String message)
      Sets the text of the error message corresponding to the passed error code.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SFSErrorCodes

        public SFSErrorCodes()
    • Method Detail

      • setErrorMessage

        public static void setErrorMessage​(short code,
                                           java.lang.String message)
        Sets the text of the error message corresponding to the passed error code.

        NOTE: you have to make sure you maintain all the placeholders while modifying the messages.
        Parameters:
        code - The code of the error message to be modified.
        message - The new error message, including the placeholders for runtime informations.

        Example
        The following example shows how to translate error 13 to French language retaining the required placeholders::

         private void someMethod() {
             SFSErrorCodes.setErrorMessage(13, "Le Groupe demandé n'est pas disponible - Salle: {0}; Groupe: {1}");
         }
         
      • getErrorMessage

        public static java.lang.String getErrorMessage​(short code,
                                                       java.lang.Object[] args)
        * API internal usage only *