Class ViewerException

  • All Implemented Interfaces:
    com.inet.error.HasErrorCode, java.io.Serializable

    @JsonData
    public class ViewerException
    extends java.lang.RuntimeException
    implements java.io.Serializable, com.inet.error.HasErrorCode
    An exception wrapper class for the i-net Clear Reports Viewer.
    Contains all information necessary for dealing with various exceptions.

    One of the most important uses of ViewerException is for prompt event handling: A ViewerException can be thrown if prompts are needed, in which case the flag "needPrompts" is true.

    Since:
    7.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ViewerException​(int errorCode, java.lang.String message, java.lang.String format, java.lang.String srvVersion, java.lang.String srvJVM, java.lang.String srvOS, int srvCache, java.lang.String stacktrace)
      Initializes an exception from the server with the given error code, message, export format, server version, server JAva VM, server OS, server cache version, and stacktrace.
      ViewerException​(int errorCode, java.lang.String message, java.lang.String format, java.lang.String srvVersion, java.lang.String srvJVM, java.lang.String srvOS, int srvCache, java.lang.String protocol, java.lang.Throwable cause)
      Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, protocol, and stacktrace.
      ViewerException​(int errorCode, java.lang.String message, java.lang.String format, java.lang.String srvVersion, java.lang.String srvJVM, java.lang.String srvOS, int srvCache, java.lang.String protocol, java.lang.Throwable cause, java.lang.String supportEmail)
      Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, protocol, and stacktrace.
      ViewerException​(int errorCode, java.lang.String message, java.lang.String format, java.lang.String srvVersion, java.lang.String srvJVM, java.lang.String srvOS, int srvCache, java.lang.Throwable cause)
      Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, and stacktrace.
      ViewerException​(PromptData[] prompts)
      For the "need prompts" Viewer Exception
      ViewerException​(java.lang.String message)
      Initializes an exception with the given error message
      ViewerException​(java.lang.String message, java.lang.Throwable cause)
      Initializes an exception with the given error message and wraps another Throwable in this ViewerException
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ViewerException createViewerException​(java.lang.Throwable cause)
      Simple factory method for creating a ViewerException as a Wrapper for a Throwable.
      static ViewerException createViewerExceptionWithMessage​(java.lang.String message, java.lang.Throwable cause)
      Wraps the given exception in a ViewerException.
      int getErrorCode()
      Returns the error code of the exception that was thrown on report server.
      static java.lang.String getErrorMessage​(java.lang.Throwable th)
      Create a user friendly error message.
      PromptData[] getPrompts()
      Sets the array of prompt information - prompt information is stored as Prompt data objects If this is not an exception encapsulating a prompt request, this will return null
      boolean isNeedPrompts()
      Whether this exception encapsulates a prompt request - in other words meaning the report can not be rendered until the prompts specified by getPrompts() are provided to the server
      void setNeedPrompts​(boolean needPrompts)
      Sets whether this exception encapsulates a prompt request - in other words meaning the report can not be rendered until the prompts specified by getPrompts() are provided to the server
      void setPrompts​(PromptData[] prompts)
      Sets the array of prompt information - prompt information is stored as Prompt data objects
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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

      • ViewerException

        public ViewerException​(int errorCode,
                               java.lang.String message,
                               java.lang.String format,
                               java.lang.String srvVersion,
                               java.lang.String srvJVM,
                               java.lang.String srvOS,
                               int srvCache,
                               java.lang.String stacktrace)
        Initializes an exception from the server with the given error code, message, export format, server version, server JAva VM, server OS, server cache version, and stacktrace.
        Parameters:
        errorCode - Error code of exception thrown on server side
        message - Error message of exception
        format - Export format at the time of the exception
        srvVersion - Server's i-net Clear Reports version
        srvJVM - Server's Java VM version
        srvOS - Server's Operating System
        srvCache - Server's Cache Version of i-net Clear Reports
        stacktrace - Stacktrace of exception thrown on server side.
        Since:
        7.0
      • ViewerException

        public ViewerException​(int errorCode,
                               java.lang.String message,
                               java.lang.String format,
                               java.lang.String srvVersion,
                               java.lang.String srvJVM,
                               java.lang.String srvOS,
                               int srvCache,
                               java.lang.Throwable cause)
        Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, and stacktrace.
        Parameters:
        errorCode - Error code of exception thrown on server side
        message - Error message of exception
        format - Export format at the time of the exception
        srvVersion - Server's i-net Clear Reports version
        srvJVM - Server's Java VM version
        srvOS - Server's Operating System
        srvCache - Server's Cache Version of i-net Clear Reports
        cause - Initializes the cause of this ViewerException to the specified value.
        Since:
        8.1
      • ViewerException

        public ViewerException​(int errorCode,
                               java.lang.String message,
                               java.lang.String format,
                               java.lang.String srvVersion,
                               java.lang.String srvJVM,
                               java.lang.String srvOS,
                               int srvCache,
                               java.lang.String protocol,
                               java.lang.Throwable cause)
        Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, protocol, and stacktrace.
        Parameters:
        errorCode - Error code of exception thrown on server side
        message - Error message of exception
        format - Export format at the time of the exception
        srvVersion - Server's i-net Clear Reports version
        srvJVM - Server's Java VM version
        srvOS - Server's Operating System
        srvCache - Server's Cache Version of i-net Clear Reports
        protocol - Protocol version used
        cause - Initializes the cause of this ViewerException to the specified value.
        Since:
        7.0
      • ViewerException

        public ViewerException​(int errorCode,
                               java.lang.String message,
                               java.lang.String format,
                               java.lang.String srvVersion,
                               java.lang.String srvJVM,
                               java.lang.String srvOS,
                               int srvCache,
                               java.lang.String protocol,
                               java.lang.Throwable cause,
                               java.lang.String supportEmail)
        Initializes an exception from the server with the given error code, message, export format, server version, server Java VM, server OS, server cache version, protocol, and stacktrace.
        Parameters:
        errorCode - Error code of exception thrown on server side
        message - Error message of exception
        format - Export format at the time of the exception
        srvVersion - Server's i-net Clear Reports version
        srvJVM - Server's Java VM version
        srvOS - Server's Operating System
        srvCache - Server's Cache Version of i-net Clear Reports
        protocol - Protocol version used
        cause - Initializes the cause of this ViewerException to the specified value.
        supportEmail - optional support email
        Since:
        14.0
      • ViewerException

        public ViewerException​(java.lang.String message)
        Initializes an exception with the given error message
        Parameters:
        message - Error message
        Since:
        7.0
      • ViewerException

        public ViewerException​(java.lang.String message,
                               java.lang.Throwable cause)
        Initializes an exception with the given error message and wraps another Throwable in this ViewerException
        Parameters:
        message - Error message of this exception
        cause - Throwable to wrap in this ViewerException
        Since:
        7.0
      • ViewerException

        public ViewerException​(PromptData[] prompts)
        For the "need prompts" Viewer Exception
        Parameters:
        prompts - Prompts needed: Array of prompt information - each prompt data object holds information about what type of prompt, what default values there are, etc.
        Since:
        7.0
        See Also:
        PromptData
    • Method Detail

      • createViewerException

        public static ViewerException createViewerException​(java.lang.Throwable cause)
        Simple factory method for creating a ViewerException as a Wrapper for a Throwable.
        Parameters:
        cause - Throwable to wrap in this ViewerException
        Returns:
        New ViewerException wrapping Throwable
        Since:
        7.0
      • createViewerExceptionWithMessage

        public static ViewerException createViewerExceptionWithMessage​(java.lang.String message,
                                                                       java.lang.Throwable cause)
        Wraps the given exception in a ViewerException. If the given exception is a ViewerException, the message is appended to the beginning and all parameters such as error code, etc., are preserved.
        Parameters:
        message - String to append to the beginning
        cause - Throwable to wrap
        Returns:
        New ViewerException wrapping Throwable with appended message.
        Since:
        7.0
      • getErrorCode

        public int getErrorCode()
        Returns the error code of the exception that was thrown on report server.
        Specified by:
        getErrorCode in interface com.inet.error.HasErrorCode
        Returns:
        errorCode Error code of exception thrown on server side
        Since:
        10.0
      • getErrorMessage

        public static java.lang.String getErrorMessage​(java.lang.Throwable th)
        Create a user friendly error message. Returns the error message contained in the given throwable, add the class name without package if it to short.
        Parameters:
        th - Throwable to extract error message from, truncated if necessary
        Returns:
        Message contained in the Throwable.
        Since:
        11.1
      • setPrompts

        public void setPrompts​(PromptData[] prompts)
        Sets the array of prompt information - prompt information is stored as Prompt data objects
        Parameters:
        prompts - Array of prompts to store in this exception
        Since:
        7.0
      • getPrompts

        public PromptData[] getPrompts()
        Sets the array of prompt information - prompt information is stored as Prompt data objects If this is not an exception encapsulating a prompt request, this will return null
        Returns:
        Prompt data objects
        Since:
        7.0
      • setNeedPrompts

        public void setNeedPrompts​(boolean needPrompts)
        Sets whether this exception encapsulates a prompt request - in other words meaning the report can not be rendered until the prompts specified by getPrompts() are provided to the server
        Parameters:
        needPrompts - Does this exception encapsulate a prompt request?
        Since:
        7.0
      • isNeedPrompts

        public boolean isNeedPrompts()
        Whether this exception encapsulates a prompt request - in other words meaning the report can not be rendered until the prompts specified by getPrompts() are provided to the server
        Returns:
        needPrompts Does this exception encapsulate a prompt request?
        Since:
        7.0