2222import es .upv .i3m .grycap .file .Utf8File ;
2323import es .upv .i3m .grycap .im .exceptions .ImClientErrorException ;
2424import es .upv .i3m .grycap .im .exceptions .ImClientException ;
25+ import es .upv .i3m .grycap .im .exceptions .ImClientServerErrorException ;
2526import es .upv .i3m .grycap .im .lang .ImMessages ;
2627import es .upv .i3m .grycap .im .pojo .ResponseError ;
2728import es .upv .i3m .grycap .im .rest .client .parameters .RestParameter ;
3031
3132import java .nio .file .Path ;
3233
34+ import javax .ws .rs .ServerErrorException ;
3335import javax .ws .rs .WebApplicationException ;
3436import javax .ws .rs .client .Client ;
3537import javax .ws .rs .client .Entity ;
@@ -144,6 +146,8 @@ public <T> T get(final String path, final Class<T> type,
144146 logCallInfo (HttpMethods .GET , path );
145147 return configureClient (path , parameters ).get (type );
146148
149+ } catch (ServerErrorException exception ) {
150+ throw new ImClientServerErrorException (createReponseError (exception ));
147151 } catch (WebApplicationException exception ) {
148152 throw new ImClientErrorException (createReponseError (exception ));
149153 }
@@ -159,6 +163,8 @@ public <T> T delete(final String path, final Class<T> type,
159163 Builder clientConfigured = configureClient (path , parameters );
160164 return clientConfigured .delete (type );
161165
166+ } catch (ServerErrorException exception ) {
167+ throw new ImClientServerErrorException (createReponseError (exception ));
162168 } catch (WebApplicationException exception ) {
163169 throw new ImClientErrorException (createReponseError (exception ));
164170 }
@@ -195,6 +201,8 @@ public <T> T post(final String path, final String bodyContent,
195201 Entity .entity (normalizedBodyContent , contentType );
196202 Builder clientConfigured = configureClient (path , parameters );
197203 return clientConfigured .post (content , type );
204+ } catch (ServerErrorException exception ) {
205+ throw new ImClientServerErrorException (createReponseError (exception ));
198206 } catch (WebApplicationException exception ) {
199207 throw new ImClientErrorException (createReponseError (exception ));
200208 }
@@ -225,6 +233,8 @@ public <T> T put(final String path, final String bodyContent,
225233 Entity .entity (normalizedBodyContent , contentType );
226234 Builder clientConfigured = configureClient (path , parameters );
227235 return clientConfigured .put (content , type );
236+ } catch (ServerErrorException exception ) {
237+ throw new ImClientServerErrorException (createReponseError (exception ));
228238 } catch (WebApplicationException exception ) {
229239 throw new ImClientErrorException (createReponseError (exception ));
230240 }
0 commit comments