Improve error reporting.

This commit is contained in:
Paulo Gustavo Veiga 2012-11-11 20:23:21 -03:00
parent 751692837c
commit df98282620
2 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,7 @@ mindplot.RESTPersistenceManager = new Class({
onFailure:function (xhr) {
var responseText = xhr.responseText;
var userMsg = {severity:"ERROR", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
var contentType = this.getHeader("Content-Type");
if (contentType != null && contentType.indexOf("application/json") != -1) {
@ -80,7 +80,7 @@ mindplot.RESTPersistenceManager = new Class({
} else {
if (this.status == 405) {
userMsg = {severity:"ERROR", message:$msg('SESSION_EXPIRED')};
userMsg = {severity:"SEVERE", message:$msg('SESSION_EXPIRED')};
}
}
events.onError(userMsg);

View File

@ -63,20 +63,20 @@ public class BaseController {
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public String handleServerErrors(@NotNull Exception ex, @NotNull HttpServletRequest request) {
public RestErrors handleServerErrors(@NotNull Exception ex, @NotNull HttpServletRequest request) {
final User user = Utils.getUser();
notificationService.reportJavaException(ex, user, request);
return ex.getMessage();
return new RestErrors(ex.getMessage(),Severity.SEVERE);
}
@ExceptionHandler(ImportUnexpectedException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public String handleImportErrors(@NotNull ImportUnexpectedException ex, @NotNull HttpServletRequest request) {
public RestErrors handleImportErrors(@NotNull ImportUnexpectedException ex, @NotNull HttpServletRequest request) {
final User user = Utils.getUser();
notificationService.reportJavaException(ex, user, new String(ex.getFreemindXml()), request);
return ex.getMessage();
return new RestErrors(ex.getMessage(),Severity.SEVERE);
}
@ExceptionHandler(ValidationException.class)
@ -87,8 +87,8 @@ public class BaseController {
@ExceptionHandler(JsonHttpMessageNotReadableException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public String handleJSONErrors(@NotNull JsonHttpMessageNotReadableException ex) {
return "Request could not be saved. Message is not valid";
public RestErrors handleJSONErrors(@NotNull JsonHttpMessageNotReadableException ex) {
return new RestErrors("Communication error",Severity.SEVERE);
}
@ExceptionHandler(java.lang.reflect.UndeclaredThrowableException.class)