Skip to content

Commit

Permalink
feature(retrofit): Add exception handler to service factory (#1185)
Browse files Browse the repository at this point in the history
This commit adds the SpinnakerRetrofitErrorHandler to service factories
which allows for clients that rely on service factories to properly have
RetrofitErrors be converted to some Spinnaker*Exception.

Signed-off-by: benjamin-j-powell <[email protected]>
Co-authored-by: benjamin-j-powell <[email protected]>
  • Loading branch information
xibz and benjamin-j-powell authored Nov 5, 2024
1 parent cf76e73 commit dbbc628
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider;
import com.netflix.spinnaker.kork.annotations.NonnullByDefault;
import com.netflix.spinnaker.kork.client.ServiceClientFactory;
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler;
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger;
import retrofit.Endpoint;
import retrofit.RequestInterceptor;
Expand Down Expand Up @@ -54,6 +55,7 @@ public <T> T create(Class<T> type, ServiceEndpoint serviceEndpoint, ObjectMapper
.setRequestInterceptor(spinnakerRequestInterceptor)
.setConverter(new JacksonConverter(objectMapper))
.setEndpoint(endpoint)
.setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance())
.setClient(new Ok3Client(clientProvider.getClient(serviceEndpoint)))
.setLogLevel(retrofitLogLevel)
.setLog(new Slf4jRetrofitLogger(type))
Expand Down

0 comments on commit dbbc628

Please sign in to comment.