Class MException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.motivewave.platform.sdk.common.MException
All Implemented Interfaces:
Serializable

public class MException extends Exception
General Exception class
See Also:
  • Constructor Details

    • MException

      public MException(ErrorCode error)
      Constructs a new MException using the given error code.
      Parameters:
      error - error code for the exception
    • MException

      public MException(ErrorCode error, Object... parameters)
      Constructs a new MException with the given error code and parameter substitution for the message.
      Parameters:
      error - the error code
      parameters - substitution parameters for the error message
    • MException

      public MException(Exception cause, ErrorCode error)
      Constructs a new MException with the cause and error msg.
      Parameters:
      cause - the cause
      error - error code
    • MException

      public MException(Exception cause, ErrorCode error, Object... parameters)
      Constructs a new MException with the cause, using the error. The given parameters will be substituted into the message.
      Parameters:
      cause - the cause
      error - error code
      parameters - substitution parameters
  • Method Details

    • getErrorCode

      public ErrorCode getErrorCode()
      Gets the error code associated with this exception.
      Returns:
      error code for this exception
    • getSource

      public Object getSource()
      Gets the source object that generated this exception.
      Returns:
      source of this exception
    • setSource

      public void setSource(Object src)
      Sets the source object that generated this exception.
      Parameters:
      src - source of this exception
    • getParameters

      public Object[] getParameters()
      Gets the exception parameters.
      Returns:
      exception parameters
    • getMessage

      public String getMessage()
      Gets the locale dependent message for this exception.
      Overrides:
      getMessage in class Throwable
      Returns:
      locale dependent message
    • getMessage

      public String getMessage(Locale locale)
      Gets the exception message in the given locale (if a translation is available).
      Parameters:
      locale - locale for the message
      Returns:
      exception message in the given locale (if a translation is available).
    • isError

      public boolean isError(ErrorCode error)
      Compares the internal error code with the given error code and returns true if they are equal.
      Parameters:
      error - error code
      Returns:
      true if the error codes are the same, false otherwise