List of usage examples for org.springframework.dao DuplicateKeyException getLocalizedMessage
public String getLocalizedMessage()
From source file:be.bittich.quote.controller.impl.DefaultExceptionHandler.java
@RequestMapping(produces = APPLICATION_JSON) @ExceptionHandler(DuplicateKeyException.class) @ResponseStatus(value = HttpStatus.CONFLICT) public @ResponseBody Map<String, Object> handleDuplicateKeyException(DuplicateKeyException ex) throws IOException { Map<String, Object> map = newHashMap(); map.put("error", "Duplicate Key Exception"); map.put("cause", ex.getLocalizedMessage()); map.put("supported", ex.getMessage()); return map;/* ww w . ja v a 2s . c o m*/ }