Skip to content

Commit

Permalink
feature(retrofit): Add exception handler to service factory
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 <bjp@apple.com>
  • Loading branch information
benjamin-j-powell committed May 30, 2024
1 parent 2d682c9 commit 3bcb353
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 3bcb353

Please sign in to comment.