mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-12 07:10:07 +02:00
Improve error reporting.
This commit is contained in:
parent
751692837c
commit
df98282620
@ -65,7 +65,7 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
onFailure:function (xhr) {
|
onFailure:function (xhr) {
|
||||||
|
|
||||||
var responseText = xhr.responseText;
|
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");
|
var contentType = this.getHeader("Content-Type");
|
||||||
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
||||||
@ -80,7 +80,7 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this.status == 405) {
|
if (this.status == 405) {
|
||||||
userMsg = {severity:"ERROR", message:$msg('SESSION_EXPIRED')};
|
userMsg = {severity:"SEVERE", message:$msg('SESSION_EXPIRED')};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events.onError(userMsg);
|
events.onError(userMsg);
|
||||||
|
@ -63,20 +63,20 @@ public class BaseController {
|
|||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String handleServerErrors(@NotNull Exception ex, @NotNull HttpServletRequest request) {
|
public RestErrors handleServerErrors(@NotNull Exception ex, @NotNull HttpServletRequest request) {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
notificationService.reportJavaException(ex, user, request);
|
notificationService.reportJavaException(ex, user, request);
|
||||||
return ex.getMessage();
|
return new RestErrors(ex.getMessage(),Severity.SEVERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ExceptionHandler(ImportUnexpectedException.class)
|
@ExceptionHandler(ImportUnexpectedException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String handleImportErrors(@NotNull ImportUnexpectedException ex, @NotNull HttpServletRequest request) {
|
public RestErrors handleImportErrors(@NotNull ImportUnexpectedException ex, @NotNull HttpServletRequest request) {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
notificationService.reportJavaException(ex, user, new String(ex.getFreemindXml()), request);
|
notificationService.reportJavaException(ex, user, new String(ex.getFreemindXml()), request);
|
||||||
return ex.getMessage();
|
return new RestErrors(ex.getMessage(),Severity.SEVERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(ValidationException.class)
|
@ExceptionHandler(ValidationException.class)
|
||||||
@ -87,8 +87,8 @@ public class BaseController {
|
|||||||
|
|
||||||
@ExceptionHandler(JsonHttpMessageNotReadableException.class)
|
@ExceptionHandler(JsonHttpMessageNotReadableException.class)
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
public String handleJSONErrors(@NotNull JsonHttpMessageNotReadableException ex) {
|
public RestErrors handleJSONErrors(@NotNull JsonHttpMessageNotReadableException ex) {
|
||||||
return "Request could not be saved. Message is not valid";
|
return new RestErrors("Communication error",Severity.SEVERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(java.lang.reflect.UndeclaredThrowableException.class)
|
@ExceptionHandler(java.lang.reflect.UndeclaredThrowableException.class)
|
||||||
|
Loading…
Reference in New Issue
Block a user