private Response translateThrowable(Throwable t) {
LOGGER.error("Error", t);
if (t instanceof CrysonException) {
return translateCrysonException((CrysonException)t);
} else if (t instanceof OptimisticLockException || t instanceof HibernateOptimisticLockingFailureException || t instanceof StaleObjectStateException) {
return translateCrysonException(new CrysonEntityConflictException("Optimistic locking failed", t));
} else if (t instanceof AccessDeniedException) {
return Response.status(Response.Status.UNAUTHORIZED).entity(buildJsonMessage(t.getMessage())).build();
} else if (t instanceof ParseException) {
return Response.status(Response.Status.BAD_REQUEST).entity(buildJsonMessage(t.getMessage())).build();
} else {