mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)
127226 gjames: RA-1064: Added a WebScriptExceptionResolver git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127592 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -73,6 +73,7 @@ public class ApiAssistant {
|
||||
});
|
||||
|
||||
private ExceptionResolver<Exception> defaultResolver = new DefaultExceptionResolver();
|
||||
private ExceptionResolver<WebScriptException> webScriptExceptionResolver;
|
||||
private ExceptionResolver<Exception> resolver;
|
||||
private JacksonHelper jsonHelper;
|
||||
|
||||
@@ -86,7 +87,15 @@ public class ApiAssistant {
|
||||
|
||||
public ErrorResponse resolveException(Exception ex)
|
||||
{
|
||||
ErrorResponse error = resolver.resolveException(ex);
|
||||
ErrorResponse error = null;
|
||||
if (ex instanceof WebScriptException)
|
||||
{
|
||||
error = webScriptExceptionResolver.resolveException((WebScriptException) ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = resolver.resolveException(ex);
|
||||
}
|
||||
if (error == null)
|
||||
{
|
||||
error = defaultResolver.resolveException(ex);
|
||||
@@ -195,6 +204,10 @@ public class ApiAssistant {
|
||||
this.defaultResolver = defaultResolver;
|
||||
}
|
||||
|
||||
public void setWebScriptExceptionResolver(ExceptionResolver<WebScriptException> webScriptExceptionResolver) {
|
||||
this.webScriptExceptionResolver = webScriptExceptionResolver;
|
||||
}
|
||||
|
||||
public void setResolver(ExceptionResolver<Exception> resolver) {
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
Reference in New Issue
Block a user