Class SpinnakerHttpException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.netflix.spinnaker.kork.exceptions.SpinnakerException
com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
All Implemented Interfaces:
com.netflix.spinnaker.kork.exceptions.HasAdditionalAttributes, Serializable

public class SpinnakerHttpException extends SpinnakerServerException
An exception that exposes the Response of a given HTTP RetrofitError or Response if retrofit 2.x used and a detail message that extracts useful information from the Response or Response. Both Response and Response can't be set together.
See Also:
  • Constructor Details

    • SpinnakerHttpException

      public SpinnakerHttpException(retrofit.RetrofitError e)
      Construct a SpinnakerHttpException corresponding to a RetrofitError.
    • SpinnakerHttpException

      public SpinnakerHttpException(retrofit2.Response<?> retrofit2Response, retrofit2.Retrofit retrofit)
      The constructor handles the HTTP retrofit2 exception, similar to retrofit logic. It is used with ErrorHandlingExecutorCallAdapterFactory.
    • SpinnakerHttpException

      public SpinnakerHttpException(String message, SpinnakerHttpException cause)
      Construct a SpinnakerHttpException with a specified message. This allows code to catch a SpinnakerHttpException and throw a new one with a custom message, while still allowing SpinnakerRetrofitExceptionHandlers to handle the exception and respond with the appropriate http status code.

      Validating only one of Response or Response is set at a time using Preconditions.checkState.

      Parameters:
      message - the message
      cause - the cause. Note that this is required (i.e. can't be null) since in the absence of a cause or a RetrofitError that provides the cause, SpinnakerHttpException is likely not the appropriate exception class to use.
  • Method Details