Skip to content

Commit ba56172

Browse files
committed
changed RestErrorHandler & RestMethodHandler to catch and handle org.springframework.core.NestedRuntimeException
1 parent 171e141 commit ba56172

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/rest/RestErrorHandler.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.androidannotations.api.rest;
1717

18-
import org.springframework.web.client.RestClientException;
18+
import org.springframework.core.NestedRuntimeException;
1919

2020
/**
2121
* This interface is used for handling rest client exceptions.
@@ -26,5 +26,5 @@ public interface RestErrorHandler {
2626
*
2727
* @param e
2828
*/
29-
void onRestClientExceptionThrown(RestClientException e);
29+
void onRestClientExceptionThrown(NestedRuntimeException e);
3030
}

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/rest/RestMethodHandler.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private JBlock surroundWithRestTryCatch(RestHolder holder, JBlock block, boolean
230230
JTryBlock tryBlock = newBlock._try();
231231
codeModelHelper.copy(block, tryBlock.body());
232232

233-
JCatchBlock jCatch = tryBlock._catch(classes().REST_CLIENT_EXCEPTION);
233+
JCatchBlock jCatch = tryBlock._catch(classes().NESTED_RUNTIME_EXCEPTION);
234234

235235
JBlock catchBlock = jCatch.body();
236236
JConditional conditional = catchBlock._if(JOp.ne(holder.getRestErrorHandlerField(), JExpr._null()));

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/CanonicalNameConstants.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public final class CanonicalNameConstants {
137137
public static final String HTTP_AUTHENTICATION = "org.springframework.http.HttpAuthentication";
138138
public static final String HTTP_BASIC_AUTHENTICATION = "org.springframework.http.HttpBasicAuthentication";
139139
public static final String REST_CLIENT_EXCEPTION = "org.springframework.web.client.RestClientException";
140+
public static final String NESTED_RUNTIME_EXCEPTION = "org.springframework.core.NestedRuntimeException";
140141

141142
/*
142143
* RoboGuice

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/process/ProcessHolder.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public class Classes {
177177
public final JClass HTTP_AUTHENTICATION = refClass(CanonicalNameConstants.HTTP_AUTHENTICATION);
178178
public final JClass HTTP_BASIC_AUTHENTICATION = refClass(CanonicalNameConstants.HTTP_BASIC_AUTHENTICATION);
179179
public final JClass REST_CLIENT_EXCEPTION = refClass(CanonicalNameConstants.REST_CLIENT_EXCEPTION);
180+
public final JClass NESTED_RUNTIME_EXCEPTION = refClass(CanonicalNameConstants.NESTED_RUNTIME_EXCEPTION);
180181
}
181182

182183
private final Map<Element, GeneratedClassHolder> generatedClassHolders = new HashMap<Element, GeneratedClassHolder>();

0 commit comments

Comments
 (0)