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
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 Summary
ConstructorsConstructorDescriptionSpinnakerHttpException(String message, SpinnakerHttpException cause) Construct a SpinnakerHttpException with a specified message.SpinnakerHttpException(retrofit.RetrofitError e) Construct a SpinnakerHttpException corresponding to a RetrofitError.SpinnakerHttpException(retrofit2.Response<?> retrofit2Response, retrofit2.Retrofit retrofit) The constructor handles the HTTP retrofit2 exception, similar to retrofit logic. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.HttpHeadersintnewInstance(String message) Methods inherited from class com.netflix.spinnaker.kork.exceptions.SpinnakerException
getRetryable, getUserMessage, setRetryableMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.netflix.spinnaker.kork.exceptions.HasAdditionalAttributes
getAdditionalAttributes
-
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 withErrorHandlingExecutorCallAdapterFactory. -
SpinnakerHttpException
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
ResponseorResponseis set at a time usingPreconditions.checkState.- Parameters:
message- the messagecause- 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
-
getResponseCode
public int getResponseCode() -
getHeaders
@Nonnull public org.springframework.http.HttpHeaders getHeaders() -
getMessage
- Overrides:
getMessagein classThrowable
-
newInstance
- Overrides:
newInstancein classSpinnakerServerException
-
getResponseBody
-
getReason
-