Package io.nitric.api

Class NitricException

    • Constructor Detail

      • NitricException

        public NitricException​(NitricException.Code code,
                               String message,
                               io.grpc.StatusRuntimeException cause,
                               io.nitric.proto.error.v1.ErrorDetails ed)
        Create a new NitricException with the given information.
        Parameters:
        code - the GRPC status code
        message - the error message
        cause - the error root cause
        ed - the structured GRPC error details
    • Method Detail

      • getCode

        public NitricException.Code getCode()
        Return the GRPC error code.
        Returns:
        the GRPC error code
      • getMessage

        public String getMessage()
        Return the error message.
        Overrides:
        getMessage in class Throwable
        Returns:
        the error message
      • getRootCause

        public String getRootCause()
        Return the root cause of the error.
        Returns:
        the root cause of the error.
      • getService

        public String getService()
        Return the API service invoked, e.g. 'Service.Method'.
        Returns:
        the name of the API service invoked.
      • getPlugin

        public String getPlugin()
        Return the name of the service plugin invoked, e.g. 'PluginService.Method'.
        Returns:
        the name of the service plugin invoked.
      • getArgs

        public Map<String,​String> getArgs()
        Return the plugin method arguments. Please note only non-sensitive data should be returned.
        Returns:
        the plugin method arguments
      • toString

        public String toString()
        Return the string representation of this object.
        Overrides:
        toString in class Throwable
        Returns:
        the string representation of this object
      • build

        public static NitricException build​(io.grpc.StatusRuntimeException sre)
        Create a new Nitric API Exception from the GRPC StatusRuntimeException.
        Parameters:
        sre - the GRPC service StatusRuntimeException (required)
        Returns:
        a new Nitric API Exception