spring-boot


How to manage Feign errors?


We are using Spring-boot with Spring-cloud and Spring-cloud-netflix with Spring-cloud-feign.
We are creating our Gateway application that with the help of Feign will try to communicate with our authentication microservice in order to validate their credentials. Here you can see an example of our Feign authentication client:
#FeignClient(value="auth", configuration = AuthClientConfiguration.class)
public interface AuthClient {
#RequestMapping(method = RequestMethod.GET, value = "/tokens", consumes = MediaType.APPLICATION_JSON_VALUE)
Single<Session> getSession(#RequestHeader("Authorization") String token);
}
The question is, how we can deal with all the exceptions that could be raised by the client? I mean, how we can for example catch that a NetworkException or a TimeoutException has been thrown? We've defined our own ErrorDecoder but it appears that this "kind of listener" only works when the request has arrived and the response returned (in our case from authentication client). So, how we can manage this other exceptions?
Best,
Error decoders are decoding HTTP error responses (500, 404, 401, etc...). Exceptions will bubble up in client calls, so using try/catch should work.
try {
return client.home();
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}

Related Links

Method: Head on /refresh is returning 500
How to configure ssl between spring boot application and cassandra using CassandraAutoConfiguration?
Being logged out when using Hazelcast distrubuted sessions in Jhipster
Force Spring Boot to use servlet mapping in web.xml
SpringBoot Test ContextConfiguration has no banner
NPE in jax-rs service for jpa query in Spring Boot + Wildfly 10
IllegalStateException in Spring Boot Application Startup
endpoints.health.sensitive=true but health endpoint still shows details
Spring Data Cassandra with QueryDSL
About spring-boot-starter-hornetq
Spring Boot use separate user for flywaydb and JPA
POST duplicate entry not causing PK collision in Spring Data REST
Cannot Query Neo4j Repositories
Spring boot archetypes not available after 1.0.2.RELEASE
Spring Boot Oauth2 with slack
Spring Cloud Config Server using SVN

Categories

HOME
asterisk
spring-boot
gulp
model-view-controller
botframework
compression
android-ndk
dynamic
postsharp
ms-application-insights
uml-designer
vsixmanifest
angularjs-ng-repeat
core-data
jetbrains
expo
saucelabs
openstack-horizon
infopath
multibinding
openscad
vivado-hls
autologin
react-jsx
gomobile
smali
tcpdf
ng-tags-input
inline-assembly
email-client
grunt-contrib-uglify
sasl
mex
proof-general
meteor-accounts
azure-table-storage
folder
xlib
openoffice-impress
overflow
minitest
pyenv
aweber
android-databinding
matrix-multiplication
quartz
taiga
risc
encoder
spring-ide
google-chrome-storage
react.rb
nao-robot
node-java
sp
gevent
git-push
qtruby
shtml
jsondoc
opendolphin
maven-antrun-plugin
biginsights
first-order-logic
uinavigationitem
page-refresh
fileinputstream
pymol
dockerpy
alpha-beta-pruning
dojox.grid
launcher
frisby.js
tigase
selenium-grid2
sat4j
oxygenxml
serializer
rpt
pyalgotrade
image-preloader
fastcgi-mono-server
flask-mongoengine
.net-reflector
node-amqp
google-oauth-java-client
raddatepicker
ironworker
leap-year
wordbreaker
cocotron
pudb
mysql2
generator-expression
setcookie
wpml
esi
mvcmailer
sqlbuddy
pinchzoom
idtabs
towerjs
fileoutputstream
soapexception
qvariant
method-call
hwnd
zipstream
onunload
text-manipulation
nscharacterset
database-agnostic
for-xml
stackless
urlscan

Resources

Encrypt Message