Class MSTRCheckedException

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MSTRCheckedException.ExceptionXMLHandler
      This handler is used to parse XML error messages, and provides a means to extract a more meaningful message out of it.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Throwable getCause()
      Retrieves the embedded throwable (or null if none).
      java.util.Locale getDefaultLocale()
      Returns default locale of this exception.
      int getErrorCode()
      Returns the error code associated with the given error.
      LocalizableMessage getLocalizableMessage()
      Returns LocalizableMessage object of this exception.
      java.lang.String getMessage()
      Returns the error message.
      java.lang.String getMessage​(boolean useXMLHandler)
      In some special scenarios, the message returned by the Intelligence Server is in XML form.
      java.lang.String getMessage​(java.util.Locale locale)
      Returns localized error message of this exception.
      java.lang.Throwable getRootCause()
      Follows the getCause chain to get the root cause.
      static java.lang.Throwable getRootCause​(java.lang.Throwable e)  
      void setCause​(java.lang.Throwable e)
      Set the embedded error
      void setDefaultLocale​(java.util.Locale locale)
      Sets the default locale of this exception.
      void setXMLHandler​(MSTRCheckedException.ExceptionXMLHandler handler)
      In some special scenarios, the message returned by the Intelligence Server is in XML form.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MSTRCheckedException

        public MSTRCheckedException​(LocalizableMessage errorMsg)
        Constructor.
        Parameters:
        errorMsg - The error message for this exception.
        Since:
        MicroStrategy Web 8.0.0
      • MSTRCheckedException

        public MSTRCheckedException​(LocalizableMessage errorMsg,
                                    java.lang.Throwable e)
        Constructor.
        Parameters:
        errorMsg - The error message for this exception.
        e - The embedded error object.
        Since:
        MicroStrategy Web 8.0.0
      • MSTRCheckedException

        public MSTRCheckedException​(int code,
                                    java.lang.Object[] params,
                                    java.util.Locale locale)
        Deprecated.
        use other constructor instead
        Constructor.
        Parameters:
        code - error code.
        locale - The locale to localize this exception.
        params - The parameters required to constructing the error message based on error code.
        Since:
        MicroStrategy Web 8.0.0
      • MSTRCheckedException

        public MSTRCheckedException​(int code,
                                    java.lang.Object[] params,
                                    java.lang.Throwable e,
                                    java.util.Locale locale)
        Deprecated.
        use other constructor instead
        Constructor.
        Parameters:
        code - error code.
        locale - The locale to localize this exception.
        params - The parameters required to constructing the error message based on error code.
        e - The embedded error.
        Since:
        MicroStrategy Web 8.0.0
      • MSTRCheckedException

        public MSTRCheckedException()
        Constructor.
      • MSTRCheckedException

        public MSTRCheckedException​(java.lang.String errorMsg)
        Constructor.
        Parameters:
        errorMsg - The error message for this exception.
      • MSTRCheckedException

        public MSTRCheckedException​(int errorCode)
        Deprecated.
        use other constructor instead
        Constructor.
        Parameters:
        errorCode - The error code for this exception.
      • MSTRCheckedException

        public MSTRCheckedException​(java.lang.String errorMsg,
                                    int errorCode)
        Constructor.
        Parameters:
        errorCode - The error code for this exception.
        errorMsg - The error message for this exception.
      • MSTRCheckedException

        public MSTRCheckedException​(java.lang.String errorMsg,
                                    int errorCode,
                                    java.lang.Throwable e)
        Constructor.
        Parameters:
        errorCode - The error code for this exception.
        errorMsg - The error message for this exception.
        e - The embedded error.
      • MSTRCheckedException

        public MSTRCheckedException​(java.lang.Throwable e)
        Constructor.
        Parameters:
        e - The embedded error.
    • Method Detail

      • getErrorCode

        public int getErrorCode()
        Returns the error code associated with the given error. If this is 0 (i.e. the error had no code associated with it), and the message is also null, it will first examine if there is an embedded exception getCause(), if so and it is either a MSTRCheckedException or MSTRUncheckedException, it will attempt to return their error code instead (recursively searching). If the error code is non-zero or the message is not null, the error code of this exception is returned.
        Specified by:
        getErrorCode in interface LocalizableException
        Returns:
        The error code for the given error.
      • getMessage

        public java.lang.String getMessage()
        Returns the error message. If this is null and the error code is 0, it will first examine if there is an embedded exception getCause(), if so and it is either a MSTRCheckedException or MSTRUncheckedException, it will attempt to return their error message instead (recursively searching). If the message is not null or the error code is non-zero, the message of this exception is returned.
        Specified by:
        getMessage in interface LocalizableException
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        The error message.
      • getMessage

        public java.lang.String getMessage​(java.util.Locale locale)
        Returns localized error message of this exception.
        Specified by:
        getMessage in interface LocalizableException
        Parameters:
        locale - locale
        Returns:
        Localized error message.
        Since:
        MicroStrategy Web 8.0.0
      • getCause

        public java.lang.Throwable getCause()
        Retrieves the embedded throwable (or null if none).
        Overrides:
        getCause in class java.lang.Throwable
        Returns:
        The embedded throwable.
      • getRootCause

        public java.lang.Throwable getRootCause()
        Follows the getCause chain to get the root cause.
      • getRootCause

        public static java.lang.Throwable getRootCause​(java.lang.Throwable e)
      • setCause

        public void setCause​(java.lang.Throwable e)
        Set the embedded error
        Parameters:
        e - The embedded error
      • getDefaultLocale

        public java.util.Locale getDefaultLocale()
        Returns default locale of this exception.
        Specified by:
        getDefaultLocale in interface LocalizableException
        Returns:
        default locale of this exception.
        Since:
        MicroStrategy Web 8.0.0
      • setDefaultLocale

        public void setDefaultLocale​(java.util.Locale locale)
        Sets the default locale of this exception.
        Specified by:
        setDefaultLocale in interface LocalizableException
        Parameters:
        locale - new default locale
        Since:
        MicroStrategy Web 8.0.0
      • setXMLHandler

        public void setXMLHandler​(MSTRCheckedException.ExceptionXMLHandler handler)
        In some special scenarios, the message returned by the Intelligence Server is in XML form. Setting a handler allows the message to be parsed into something more meaningful. This only affects the output of the following methods: getMessage(), and getMessage(Locale).
        Parameters:
        handler - XML handler
        Since:
        MicroStrategy Web 9.0.0
      • getMessage

        public java.lang.String getMessage​(boolean useXMLHandler)
        In some special scenarios, the message returned by the Intelligence Server is in XML form. This method governs whether setXMLHandler(ExceptionXMLHandler) should be used or bypassed.
        Parameters:
        useXMLHandler - whether to bypass setXMLHandler(ExceptionXMLHandler)
        Returns:
        the underlying message
        Since:
        MicroStrategy Web 9.0.0