Class RequestException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    LowResourceException, PauseTimeException

    public class RequestException
    extends P4JavaException
    An exception to be used to signal that the Perforce server has detected an error in processing or fielding a request. This error might be a usage error in a command sent to the server, or a missing or bad parameter, or a semantics error in the request. Note that this is not the same as a connection exception, which is typically signaled when the Perforce server itself can't be reached.

    RequestExceptions coming back from the server have a non-zero rawCode field that is set to the corresponding raw code value sent from the server; this code normally requires processing for use by callers, who typically want to see the correspond generic and severity codes, but it's available here if needed. Other segments or interpretations of the raw code -- subCode, subSystem, uniqueCode, and the raw code itself -- are available here if you need them and know what they mean. Note, though, that only the generic and severity codes are documented in the main Perforce documentation, and only those fields are guaranteed to be set to meaningful values here (in fact, all RequestExceptions constructed 'under the covers' in the RPC layer will do what they can to get meaningful value for these other fields, but this is not guaranteed)...

    Note that if you set the raw code yourself using the accessor methods, you are required to also set the other fields to appropriate values yourself; failure to do this will cause a lot of confusion up the chain, as the subsidiary codes are only calculated once. The setCodes method is provided to make this easy.

    See the MessageSeverityCode and MessageGenericCode definitions for suitable help with those types of code.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDisplayString()  
      int getGenericCode()
      Get the Perforce generic code associated with this exception, if any.
      int getRawCode()  
      int getSeverityCode()
      Get the Perforce severity code associated with this exception, if any.
      int getSubCode()  
      int getSubSystem()  
      int getUniqueCode()  
      RequestException setCodes​(int rawCode)
      Set the raw code and associated subsidiary codes according to the passed-in values.
      void setGenericCode​(int genericCode)  
      void setSeverityCode​(int severityCode)  
      void setSubCode​(int subCode)  
      void setSubSystem​(int subSystem)  
      void setUniqueCode​(int uniqueCode)  
      • 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

      • RequestException

        public RequestException()
      • RequestException

        public RequestException​(java.lang.String message,
                                java.lang.Throwable cause)
      • RequestException

        public RequestException​(java.lang.String message)
      • RequestException

        public RequestException​(java.lang.Throwable cause)
      • RequestException

        public RequestException​(java.lang.String message,
                                int rawCode)
      • RequestException

        public RequestException​(java.lang.String message,
                                java.lang.String codeString)
      • RequestException

        public RequestException​(java.lang.String message,
                                int genericCode,
                                int severityCode)
      • RequestException

        public RequestException​(java.lang.Throwable cause,
                                int genericCode,
                                int severityCode)
      • RequestException

        public RequestException​(java.lang.String message,
                                java.lang.Throwable cause,
                                int genericCode,
                                int severityCode)
    • Method Detail

      • setCodes

        public RequestException setCodes​(int rawCode)
        Set the raw code and associated subsidiary codes according to the passed-in values. If you only have the raw code from the server, this is probably the easiest and least error-prone way to set the request exception codes.
        Parameters:
        rawCode - raw code from the server.
        Returns:
        'this' for chaining.
      • setSeverityCode

        public void setSeverityCode​(int severityCode)
      • setGenericCode

        public void setGenericCode​(int genericCode)
      • getDisplayString

        public java.lang.String getDisplayString()
      • getUniqueCode

        public int getUniqueCode()
      • setUniqueCode

        public void setUniqueCode​(int uniqueCode)
      • getRawCode

        public int getRawCode()
      • getSubCode

        public int getSubCode()
      • setSubCode

        public void setSubCode​(int subCode)
      • getSubSystem

        public int getSubSystem()
      • setSubSystem

        public void setSubSystem​(int subSystem)
      • getSeverityCode

        public int getSeverityCode()
        Get the Perforce severity code associated with this exception, if any. See the MessageSeverityCode Javadocs for an explanation of these codes.
        Returns:
        code
      • getGenericCode

        public int getGenericCode()
        Get the Perforce generic code associated with this exception, if any. See the MessageSGenericCode Javadocs for an explanation of these codes.
        Returns:
        code