Improve report information.

This commit is contained in:
Paulo Gustavo Veiga
2012-08-30 21:23:10 -03:00
parent df52d57a1d
commit 45858f393e
6 changed files with 50 additions and 54 deletions

View File

@@ -26,12 +26,15 @@ import com.wisemapping.security.Utils;
import com.wisemapping.service.MindmapService;
import com.wisemapping.service.UserService;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@Controller
public class AccountController extends BaseController {
@Qualifier("userService")
@@ -99,11 +102,11 @@ public class AccountController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changePassword(@RequestBody RestLogItem item) {
public void changePassword(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) {
final Mindmap mindmap = mindmapService.findMindmapById(item.getMapId());
final User user = Utils.getUser();
logger.error("Unexpected editor error - " + item.getJsErrorMsg());
notificationService.reportMindmapEditorError(mindmap, user, item.getUserAgent(), item.getJsErrorMsg() + "\n" + item.getJsStack());
notificationService.reportJavascriptException(mindmap, user, item.getJsErrorMsg() + "\n" + item.getJsStack(), request);
}
}

View File

@@ -31,8 +31,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.util.WebUtils;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
@@ -62,7 +60,7 @@ public class BaseController {
@ResponseBody
public String handleServerErrors(@NotNull Exception ex, @NotNull HttpServletRequest request) {
final User user = Utils.getUser();
notificationService.reportUnexpectedError(ex, user, request.getHeader(UserAgent.USER_AGENT_HEADER));
notificationService.reportJavaException(ex, user, request);
return ex.getMessage();
}

View File

@@ -44,7 +44,7 @@ public class TransformView extends AbstractView {
@Autowired
private Jaxb2Marshaller jaxbMarshaller;
public TransformView(@NotNull final String contentType,@NotNull NotificationService notificationService) {
public TransformView(@NotNull final String contentType, @NotNull NotificationService notificationService) {
this.contentType = contentType;
this.notificationService = notificationService;
this.exportFormat = ExportFormat.fromContentType(contentType);
@@ -93,7 +93,7 @@ public class TransformView extends AbstractView {
factory.export(properties, null, outputStream, content);
}
} catch (Throwable e) {
notificationService.reportMindmapExportError(content, Utils.getUser(), request.getHeader("User-Agent"),e);
notificationService.reportJavaException(e, Utils.getUser(), content, request);
}
}
@@ -101,5 +101,6 @@ public class TransformView extends AbstractView {
public String getContentType() {
return contentType;
}
private static final String IMG_SIZE_PARAMETER = "imgSize";
}