commit 01f3ae2369c198a5d21093cdfda37846f07c8bce
Author: Pavel Fidransky <pavel.fidransky@yoso.fi>
Date:   Sat Jun 27 13:31:25 2020 +0200

    re #41 global exception handler

diff --git a/server/src/main/java/org/danekja/ymanager/business/ApiManager.java b/server/src/main/java/org/danekja/ymanager/business/ApiManager.java
index 1d6c743..261eb43 100644
--- a/server/src/main/java/org/danekja/ymanager/business/ApiManager.java
+++ b/server/src/main/java/org/danekja/ymanager/business/ApiManager.java
@@ -11,12 +11,12 @@ import org.danekja.ymanager.repository.RequestRepository;
 import org.danekja.ymanager.repository.SettingsRepository;
 import org.danekja.ymanager.repository.UserRepository;
 import org.danekja.ymanager.repository.VacationRepository;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataAccessException;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Component;
+import org.springframework.web.server.ResponseStatusException;
 
 import javax.annotation.security.DenyAll;
 import java.time.LocalDate;
@@ -49,111 +49,85 @@ public class ApiManager implements Manager {
 
     @Override
     @IsEmployer
-    public List<VacationRequest> getVacationRequests(Status status) throws RESTFullException {
-        try {
-            return status == null ? requestRepository.getAllVacationRequests() : requestRepository.getAllVacationRequests(status);
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+    public List<VacationRequest> getVacationRequests(Status status) {
+        if (status == null) {
+            return requestRepository.getAllVacationRequests();
+        } else {
+            return requestRepository.getAllVacationRequests(status);
         }
     }
 
     @Override
     @IsEmployer
-    public List<AuthorizationRequest> getAuthorizationRequests(Status status) throws RESTFullException {
-        try {
-            return status == null ? requestRepository.getAllAuthorizations() : requestRepository.getAllAuthorizations(status);
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+    public List<AuthorizationRequest> getAuthorizationRequests(Status status) {
+        if (status == null) {
+            return requestRepository.getAllAuthorizations();
+        } else {
+            return requestRepository.getAllAuthorizations(status);
         }
     }
 
     @Override
     @IsSignedIn
-    public DefaultSettings getDefaultSettings() throws RESTFullException {
-        try {
-            return settingsRepository.get();
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
-        }
+    public DefaultSettings getDefaultSettings() {
+        return settingsRepository.get();
     }
 
     @Override
     @IsOwner
-    public List<VacationDay> getUserCalendar(Long userId, LocalDate fromDate, LocalDate toDate, Status status) throws RESTFullException {
-        try {
-            List<VacationDay> vacations;
-            if (status == null && toDate == null) {
-                vacations = vacationRepository.getVacationDays(userId, fromDate);
-            } else if (status == null) {
-                vacations = vacationRepository.getVacationDays(userId, fromDate, toDate);
-            } else if (toDate != null) {
-                vacations = vacationRepository.getVacationDays(userId, fromDate, toDate, status);
-            } else {
-                vacations = vacationRepository.getVacationDays(userId, fromDate, status);
-            }
-
-            return vacations;
-
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+    public List<VacationDay> getUserCalendar(long userId, LocalDate fromDate, LocalDate toDate, Status status) {
+        List<VacationDay> vacations;
+        if (status == null && toDate == null) {
+            vacations = vacationRepository.getVacationDays(userId, fromDate);
+        } else if (status == null) {
+            vacations = vacationRepository.getVacationDays(userId, fromDate, toDate);
+        } else if (toDate != null) {
+            vacations = vacationRepository.getVacationDays(userId, fromDate, toDate, status);
+        } else {
+            vacations = vacationRepository.getVacationDays(userId, fromDate, status);
         }
+
+        return vacations;
     }
 
     @Override
     @IsEmployer
-    public void createSettings(DefaultSettings settings) throws RESTFullException {
-        try {
-            DefaultSettings defaultSettings = new DefaultSettings();
-            defaultSettings.setSickDayCount(settings.getSickDayCount());
-            defaultSettings.setNotification(settings.getNotification());
-            userRepository.insertSettings(defaultSettings);
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
-        }
+    public void createSettings(DefaultSettings settings) {
+        DefaultSettings defaultSettings = new DefaultSettings();
+        defaultSettings.setSickDayCount(settings.getSickDayCount());
+        defaultSettings.setNotification(settings.getNotification());
+        userRepository.insertSettings(defaultSettings);
     }
 
     @Override
     @IsOwner
-    public void createVacation(Long userId, VacationDay vacationDay) throws RESTFullException {
-
+    public void createVacation(long userId, VacationDay vacationDay) {
         if (vacationDay.getDate().isBefore(LocalDate.now())) {
-            throw new RESTFullException("Vacation cannot be token in past.", "vacation.past.error");
+            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Vacation cannot be token in past.");
         }
 
-        try {
-
-            if (vacationRepository.isExistVacationForUser(userId, vacationDay.getDate())) {
-                throw new RESTFullException("Cannot take a double vacation for the same day.", "vacation.double.error");
-            }
-
-            User user = userRepository.getUser(userId);
-            vacationDay.setStatus(user.getRole() == UserRole.EMPLOYER ? Status.ACCEPTED : Status.PENDING);
-
-            Vacation vacation = new Vacation();
-            vacation.setDate(vacationDay.getDate());
-            vacation.setFrom(vacationDay.getFrom());
-            vacation.setTo(vacationDay.getTo());
-            vacation.setStatus(vacationDay.getStatus());
-            vacation.setType(vacationDay.getType());
+        if (vacationRepository.isExistVacationForUser(userId, vacationDay.getDate())) {
+            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Cannot take a double vacation for the same day.");
+        }
 
-            if (vacation.getType() == VacationType.VACATION) {
-                user.takeVacation(vacation.getFrom(), vacation.getTo());
-            } else {
-                user.takeSickDay();
-            }
+        User user = userRepository.getUser(userId);
+        vacationDay.setStatus(user.getRole() == UserRole.EMPLOYER ? Status.ACCEPTED : Status.PENDING);
 
-            vacationRepository.insertVacationDay(userId, vacation);
-            userRepository.updateUser(user);
+        Vacation vacation = new Vacation();
+        vacation.setDate(vacationDay.getDate());
+        vacation.setFrom(vacationDay.getFrom());
+        vacation.setTo(vacationDay.getTo());
+        vacation.setStatus(vacationDay.getStatus());
+        vacation.setType(vacationDay.getType());
 
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+        if (vacation.getType() == VacationType.VACATION) {
+            user.takeVacation(vacation.getFrom(), vacation.getTo());
+        } else {
+            user.takeSickDay();
         }
+
+        vacationRepository.insertVacationDay(userId, vacation);
+        userRepository.updateUser(user);
     }
 
     private void changeSettingsByEmployee(User user, UserSettings settings, DefaultSettings defaultSettings) {
@@ -198,126 +172,104 @@ public class ApiManager implements Manager {
 
     @Override
     @IsOwner
-    public void changeSettings(Long userId, UserSettings settings) throws RESTFullException {
-
-        try {
-            UserRole invokedUserPermission = authService.getCurrentUser().getRole();
-            boolean invokedUserIsAdmin = invokedUserPermission.equals(UserRole.EMPLOYER);
-            DefaultSettings defaultSettings = getDefaultSettings();
-
-            User userForChange = userRepository.getUser(settings.getId() == null ? userId : settings.getId());
+    public void changeSettings(long userId, UserSettings settings) {
+        UserRole invokedUserPermission = authService.getCurrentUser().getRole();
+        boolean invokedUserIsAdmin = invokedUserPermission.equals(UserRole.EMPLOYER);
+        DefaultSettings defaultSettings = getDefaultSettings();
 
-            if (invokedUserIsAdmin) {
-                changeSettingsByEmployer(userForChange, settings, defaultSettings);
-            } else {
-                changeSettingsByEmployee(userForChange, settings, defaultSettings);
-            }
-
-            userRepository.updateUserSettings(userForChange);
+        User userForChange = userRepository.getUser(settings.getId() == null ? userId : settings.getId());
 
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+        if (invokedUserIsAdmin) {
+            changeSettingsByEmployer(userForChange, settings, defaultSettings);
+        } else {
+            changeSettingsByEmployee(userForChange, settings, defaultSettings);
         }
+
+        userRepository.updateUserSettings(userForChange);
     }
 
     @Override
     //TODO not called anyway, allow after reimplementation
     @DenyAll
-    public void changeVacation(VacationDay vacationDay) throws RESTFullException {
-        try {
-            Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationDay.getId());
-            if (vacation.isPresent()) {
-                vacation.get().setDate(vacationDay.getDate());
-                vacation.get().setStatus(vacationDay.getStatus());
-                vacation.get().setType(vacationDay.getType());
-                vacation.get().setTime(vacationDay.getFrom(), vacationDay.getTo());
-                vacationRepository.updateVacationDay(vacation.get());
-            }
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+    public void changeVacation(VacationDay vacationDay) {
+        Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationDay.getId());
+        if (vacation.isPresent()) {
+            vacation.get().setDate(vacationDay.getDate());
+            vacation.get().setStatus(vacationDay.getStatus());
+            vacation.get().setType(vacationDay.getType());
+            vacation.get().setTime(vacationDay.getFrom(), vacationDay.getTo());
+            vacationRepository.updateVacationDay(vacation.get());
         }
     }
 
     @Override
     @IsEmployer
-    public void changeRequest(RequestType type, BasicRequest request) throws RESTFullException {
-        try {
-            switch (type) {
-                case VACATION: {
+    public void changeRequest(RequestType type, BasicRequest request) {
+        switch (type) {
+            case VACATION:
+                Optional<Vacation> vacationDayOpt = vacationRepository.getVacationDay(request.getId());
+                if (!vacationDayOpt.isPresent()) {
+                    throw new ResponseStatusException(HttpStatus.NOT_FOUND);
+                }
 
-                    Optional<Vacation> vacationDayOpt = vacationRepository.getVacationDay(request.getId());
+                Vacation vacation = vacationDayOpt.get();
 
-                    if (!vacationDayOpt.isPresent()) {
-                        throw new RESTFullException("", "");
-                    }
+                if (request.getStatus().equals(Status.REJECTED)) {
+                    User user = userRepository.getUser(vacation.getUserId());
 
-                    Vacation vacation = vacationDayOpt.get();
-
-                    if (request.getStatus().equals(Status.REJECTED)) {
-                        User user = userRepository.getUser(vacation.getUserId());
-
-                        switch (vacation.getType()) {
-                            case VACATION: {
-                                user.addVacationCount(vacation.getFrom(), vacation.getTo());
-                                userRepository.updateUserTakenVacation(user);
-                            } break;
-                            case SICK_DAY: {
-                                user.addTakenSickDayCount(-1);
-                                userRepository.updateUserTakenSickDay(user);
-                            } break;
-                        }
+                    switch (vacation.getType()) {
+                        case VACATION: {
+                            user.addVacationCount(vacation.getFrom(), vacation.getTo());
+                            userRepository.updateUserTakenVacation(user);
+                        } break;
+                        case SICK_DAY: {
+                            user.addTakenSickDayCount(-1);
+                            userRepository.updateUserTakenSickDay(user);
+                        } break;
                     }
+                }
 
-                    requestRepository.updateVacationRequest(vacation.getId(), request.getStatus());
+                requestRepository.updateVacationRequest(vacation.getId(), request.getStatus());
+                break;
 
-                } break;
-                case AUTHORIZATION: {
-                    requestRepository.updateAuthorization(request);
-                } break;
-            }
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
-        } catch (IllegalArgumentException e) {
-            throw new RESTFullException("Cannot create a domain object.", e.getMessage());
+            case AUTHORIZATION:
+                requestRepository.updateAuthorization(request);
+                break;
         }
     }
 
     @Override
     @CanModifyVacation
-    public void deleteVacation(Long vacationId) throws RESTFullException {
-        try {
-            Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationId);
+    public void deleteVacation(long vacationId) {
+        Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationId);
+        if (!vacation.isPresent()) {
+            throw new ResponseStatusException(HttpStatus.NOT_FOUND);
+        }
 
-            if (!vacation.isPresent()) {
-                throw new RESTFullException("", "");
-            }
+        Vacation vacationDay = vacation.get();
 
-            Vacation vacationDay = vacation.get();
-            User user = userRepository.getUser(vacationDay.getUserId());
+        if (!vacationDay.getDate().isAfter(LocalDate.now())) {
+            return;
+        }
 
-            if (vacationDay.getDate().isAfter(LocalDate.now())) {
-                if (!vacationDay.getStatus().equals(Status.REJECTED)) {
-                    switch (vacationDay.getType()) {
-                        case VACATION: {
-                            user.addVacationCount(vacationDay.getFrom(), vacationDay.getTo());
-                            userRepository.updateUserTakenVacation(user);
-                        }
-                        break;
-                        case SICK_DAY: {
-                            user.addTakenSickDayCount(-1);
-                            userRepository.updateUserTakenSickDay(user);
-                        }
-                        break;
-                    }
-                }
-                vacationRepository.deleteVacationDay(vacationDay.getId());
-            }
-        } catch (DataAccessException e) {
-            log.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+        if (vacationDay.getStatus().equals(Status.REJECTED)) {
+            return;
+        }
+
+        User user = userRepository.getUser(vacationDay.getUserId());
+
+        switch (vacationDay.getType()) {
+            case VACATION:
+                user.addVacationCount(vacationDay.getFrom(), vacationDay.getTo());
+                userRepository.updateUserTakenVacation(user);
+                break;
+
+            case SICK_DAY:
+                user.addTakenSickDayCount(-1);
+                userRepository.updateUserTakenSickDay(user);
+                break;
         }
+
+        vacationRepository.deleteVacationDay(vacationDay.getId());
     }
 }
diff --git a/server/src/main/java/org/danekja/ymanager/business/FileService.java b/server/src/main/java/org/danekja/ymanager/business/FileService.java
index 174a08b..83fff44 100644
--- a/server/src/main/java/org/danekja/ymanager/business/FileService.java
+++ b/server/src/main/java/org/danekja/ymanager/business/FileService.java
@@ -1,11 +1,11 @@
 package org.danekja.ymanager.business;
 
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
+import java.io.IOException;
 
 public interface FileService {
 
-    FileImportResult parseXLSFile(String fileName, byte[] bytes) throws RESTFullException;
+    FileImportResult parseXLSFile(String fileName, byte[] bytes) throws IOException;
 
-    FileExportResult createPDFFile() throws RESTFullException;
+    FileExportResult createPDFFile() throws IOException;
 
 }
diff --git a/server/src/main/java/org/danekja/ymanager/business/FileServiceImpl.java b/server/src/main/java/org/danekja/ymanager/business/FileServiceImpl.java
index e91954b..0224a0c 100644
--- a/server/src/main/java/org/danekja/ymanager/business/FileServiceImpl.java
+++ b/server/src/main/java/org/danekja/ymanager/business/FileServiceImpl.java
@@ -6,7 +6,6 @@ import org.apache.pdfbox.pdmodel.PDPageContentStream;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import org.danekja.ymanager.business.file.excel.*;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
 import org.springframework.stereotype.Component;
 
 import java.io.ByteArrayInputStream;
@@ -23,16 +22,11 @@ public class FileServiceImpl implements FileService {
     }
 
     @Override
-    public FileImportResult parseXLSFile(String fileName, byte[] bytes) throws RESTFullException {
+    public FileImportResult parseXLSFile(String fileName, byte[] bytes) throws IOException {
 
-        try {
-            Map<String, Content> contentMap = getContentInfo(ExcelParser.parseXLSX(new ByteArrayInputStream(bytes)));
+        Map<String, Content> contentMap = getContentInfo(ExcelParser.parseXLSX(new ByteArrayInputStream(bytes)));
 
-            return new FileImportResult(fileName, (long) contentMap.size());
-
-        } catch (IOException e) {
-            throw new RESTFullException("", "");
-        }
+        return new FileImportResult(fileName, (long) contentMap.size());
     }
 
     private Map<String, Content> getContentInfo(Map<String, SheetContent[]> sheetForName) {
@@ -60,32 +54,27 @@ public class FileServiceImpl implements FileService {
 
 
     @Override
-    public FileExportResult createPDFFile() throws RESTFullException {
+    public FileExportResult createPDFFile() throws IOException {
 
         PDDocument document = new PDDocument();
         PDPage page1 = new PDPage(PDRectangle.A4);
         document.addPage(page1);
 
-        try {
-            PDPageContentStream cos = new PDPageContentStream(document, page1);
+        PDPageContentStream cos = new PDPageContentStream(document, page1);
 
-            cos.beginText();
-            cos.setFont(PDType1Font.HELVETICA, 12);
-            cos.newLineAtOffset(100, 10);
-            cos.showText("Test");
-            cos.endText();
+        cos.beginText();
+        cos.setFont(PDType1Font.HELVETICA, 12);
+        cos.newLineAtOffset(100, 10);
+        cos.showText("Test");
+        cos.endText();
 
-            cos.close();
+        cos.close();
 
-            ByteArrayOutputStream output = new ByteArrayOutputStream();
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
 
-            document.save(output);
-            document.close();
+        document.save(output);
+        document.close();
 
-            return new FileExportResult("export.pdf", output.toByteArray());
-
-        } catch (IOException e) {
-            throw new RESTFullException("", "");
-        }
+        return new FileExportResult("export.pdf", output.toByteArray());
     }
 }
diff --git a/server/src/main/java/org/danekja/ymanager/business/Manager.java b/server/src/main/java/org/danekja/ymanager/business/Manager.java
index e11760c..85d967e 100644
--- a/server/src/main/java/org/danekja/ymanager/business/Manager.java
+++ b/server/src/main/java/org/danekja/ymanager/business/Manager.java
@@ -4,7 +4,6 @@ import org.danekja.ymanager.domain.DefaultSettings;
 import org.danekja.ymanager.domain.RequestType;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.dto.*;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
 
 import java.time.LocalDate;
 import java.util.List;
@@ -12,23 +11,23 @@ import java.util.List;
 public interface Manager {
 
 
-    List<VacationRequest> getVacationRequests(Status status) throws RESTFullException;
+    List<VacationRequest> getVacationRequests(Status status);
 
-    List<AuthorizationRequest> getAuthorizationRequests(Status status) throws RESTFullException;
+    List<AuthorizationRequest> getAuthorizationRequests(Status status);
 
-    DefaultSettings getDefaultSettings() throws RESTFullException;
+    DefaultSettings getDefaultSettings();
 
-    List<VacationDay> getUserCalendar(Long userId, LocalDate fromDate, LocalDate toDate, Status status) throws RESTFullException;
+    List<VacationDay> getUserCalendar(long userId, LocalDate fromDate, LocalDate toDate, Status status);
 
-    void createSettings(DefaultSettings settings) throws RESTFullException;
+    void createSettings(DefaultSettings settings);
 
-    void createVacation(Long userId, VacationDay vacationDay) throws RESTFullException;
+    void createVacation(long userId, VacationDay vacationDay);
 
-    void changeSettings(Long userId, UserSettings settings) throws RESTFullException;
+    void changeSettings(long userId, UserSettings settings);
 
-    void changeVacation(VacationDay vacationDay) throws RESTFullException;
+    void changeVacation(VacationDay vacationDay);
 
-    void changeRequest(RequestType type, BasicRequest request) throws RESTFullException;
+    void changeRequest(RequestType type, BasicRequest request);
 
-    void deleteVacation(Long vacationId) throws RESTFullException;
+    void deleteVacation(long vacationId);
 }
diff --git a/server/src/main/java/org/danekja/ymanager/business/UserManager.java b/server/src/main/java/org/danekja/ymanager/business/UserManager.java
index 29ea923..faa6d7b 100644
--- a/server/src/main/java/org/danekja/ymanager/business/UserManager.java
+++ b/server/src/main/java/org/danekja/ymanager/business/UserManager.java
@@ -4,7 +4,6 @@ import org.danekja.ymanager.domain.GoogleUser;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.User;
 import org.danekja.ymanager.dto.BasicProfileUser;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
 import org.springframework.security.oauth2.core.oidc.OidcIdToken;
 
 import java.util.List;
@@ -21,9 +20,8 @@ public interface UserManager {
      *
      * @param status status filter value
      * @return list of users or empty list if none found
-     * @throws RESTFullException
      */
-    List<BasicProfileUser> getUsers(Status status) throws RESTFullException;
+    List<BasicProfileUser> getUsers(Status status);
 
     /**
      * Gets user by id (PK)
diff --git a/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java b/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
index f12d47c..64ebc39 100644
--- a/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
+++ b/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
@@ -8,11 +8,10 @@ import org.danekja.ymanager.dto.BasicProfileUser;
 import org.danekja.ymanager.repository.SettingsRepository;
 import org.danekja.ymanager.repository.UserRepository;
 import org.danekja.ymanager.repository.VacationRepository;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataAccessException;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.oauth2.core.oidc.OidcIdToken;
 import org.springframework.stereotype.Service;
@@ -51,30 +50,27 @@ public class DefaultUserManager implements UserManager {
     public GoogleUser getUser(OidcIdToken token) {
         //TODO replace with better user object creation after we update the data model - registered and oauth users should be
         //TODO in separate tables. We do this here because we need the ID value set
-        User user = userRepository.getUser(token.getEmail());
-
-        return user != null ? new GoogleUser(user.getId(), user.getUserData(), token) : null;
+        try {
+            User user = userRepository.getUser(token.getEmail());
+            return new GoogleUser(user.getId(), user.getUserData(), token);
+        } catch (IncorrectResultSizeDataAccessException e) {
+            return null;
+        }
     }
 
     @Override
     @IsEmployer
-    public List<BasicProfileUser> getUsers(Status status) throws RESTFullException {
-        try {
-            List<BasicProfileUser> users = userRepository.getAllBasicUsers(status == null ? Status.ACCEPTED : status);
-
-            LocalDate today = LocalDate.now();
-            LocalDate weekBefore = today.minusWeeks(1);
-            LocalDate weekAfter = today.plusWeeks(1);
-            for (BasicProfileUser user : users) {
-                user.setCalendar(vacationRepository.getVacationDays(user.getId(), weekBefore, weekAfter));
-            }
-
-            return users;
-
-        } catch (DataAccessException e) {
-            LOG.error(e.getMessage());
-            throw new RESTFullException(e.getMessage(), "database.error");
+    public List<BasicProfileUser> getUsers(Status status) {
+        List<BasicProfileUser> users = userRepository.getAllBasicUsers(status == null ? Status.ACCEPTED : status);
+
+        LocalDate today = LocalDate.now();
+        LocalDate weekBefore = today.minusWeeks(1);
+        LocalDate weekAfter = today.plusWeeks(1);
+        for (BasicProfileUser user : users) {
+            user.setCalendar(vacationRepository.getVacationDays(user.getId(), weekBefore, weekAfter));
         }
+
+        return users;
     }
 
     @Override
diff --git a/server/src/main/java/org/danekja/ymanager/repository/RepositoryUtils.java b/server/src/main/java/org/danekja/ymanager/repository/RepositoryUtils.java
deleted file mode 100644
index d85b29b..0000000
--- a/server/src/main/java/org/danekja/ymanager/repository/RepositoryUtils.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.danekja.ymanager.repository;
-
-import org.springframework.dao.IncorrectResultSizeDataAccessException;
-
-import java.util.List;
-
-public class RepositoryUtils {
-
-    /**
-     * Method which extracts single result from a list which is expected to contains 0 or 1 results.
-     *
-     * @param queryResult query result in form of {@link List}
-     * @param <T>         type of object expected in the list
-     * @return the object from the list or null (when empty)
-     * @throws IncorrectResultSizeDataAccessException when #queryResult contains more than 1 object
-     */
-    public static <T> T singleResult(List<T> queryResult) {
-        switch (queryResult.size()) {
-            case 0:
-                return null;
-            case 1:
-                return queryResult.get(0);
-            default:
-                throw new IncorrectResultSizeDataAccessException(1, queryResult.size());
-        }
-    }
-}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
index d5d1337..9ad8ad5 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
@@ -186,9 +186,7 @@ public class UserRepository {
      * @return found user object or null (if not found)
      */
     public RegisteredUser getUser(final String email) {
-        List<RegisteredUser> users = this.jdbc.query("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
-
-        return RepositoryUtils.singleResult(users);
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
     }
 
     /**
@@ -198,9 +196,7 @@ public class UserRepository {
      * @return found user object or null (if not found)
      */
     public RegisteredUser getUser(final long id) {
-        List<RegisteredUser> users = this.jdbc.query("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
-
-        return RepositoryUtils.singleResult(users);
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
     }
 
     /**
@@ -210,9 +206,7 @@ public class UserRepository {
      * @return
      */
     public UserData getUserData(final long id) {
-        List<UserData> users = this.jdbc.query("SELECT * FROM end_user WHERE id = ?", USER_DATA_MAPPER, id);
-
-        return RepositoryUtils.singleResult(users);
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_DATA_MAPPER, id);
     }
 
     public void updateUser(final User user) {
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/ApiController.java b/server/src/main/java/org/danekja/ymanager/ws/rest/ApiController.java
index 8eda547..e92503f 100644
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/ApiController.java
+++ b/server/src/main/java/org/danekja/ymanager/ws/rest/ApiController.java
@@ -1,15 +1,12 @@
 package org.danekja.ymanager.ws.rest;
 
+import org.danekja.ymanager.business.FileExportResult;
 import org.danekja.ymanager.business.FileService;
 import org.danekja.ymanager.business.Manager;
 import org.danekja.ymanager.domain.RequestType;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.User;
-import org.danekja.ymanager.dto.BasicRequest;
-import org.danekja.ymanager.dto.DefaultSettings;
-import org.danekja.ymanager.dto.UserSettings;
-import org.danekja.ymanager.dto.VacationDay;
-import org.danekja.ymanager.util.localization.Language;
+import org.danekja.ymanager.dto.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.ResponseEntity;
@@ -19,11 +16,12 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
+import java.util.List;
 
 import static org.springframework.web.bind.annotation.RequestMethod.*;
 
 @RestController
-public class ApiController extends BaseController {
+public class ApiController {
 
     private final Manager manager;
 
@@ -38,144 +36,133 @@ public class ApiController extends BaseController {
     // *********************** GET ****************************
 
     @RequestMapping(value = "/users/requests/vacation", method=GET)
-    public ResponseEntity usersRequestsVacation(
+    public List<VacationRequest> usersRequestsVacation(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestParam(value = "status", required = false) String status)
     {
-        return handle(Language.getLanguage(lang), () ->
-                manager.getVacationRequests(Status.getStatus(status))
-        );
+        return manager.getVacationRequests(Status.getStatus(status));
     }
 
     @RequestMapping(value = "/users/requests/authorization", method=GET)
-    public ResponseEntity userRequestsAuthorization(
+    public List<AuthorizationRequest> userRequestsAuthorization(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestParam(value = "status", required = false) String status)
     {
-        return handle(Language.getLanguage(lang), () ->
-                manager.getAuthorizationRequests(Status.getStatus(status))
-         );
+        return manager.getAuthorizationRequests(Status.getStatus(status));
     }
 
     @RequestMapping(value = "/user/{id}/calendar", method=GET)
-    public ResponseEntity userCalendar(
+    public List<VacationDay> userCalendar(
             @PathVariable("id") Long id,
             @RequestParam(value = "lang", required = false) String lang,
             @RequestParam(value = "from") String from,
             @RequestParam(value = "to", required = false) String to,
             @RequestParam(value = "status", required = false) String status)
     {
-        return handle(Language.getLanguage(lang), () -> {
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
-            LocalDate fromDate = LocalDate.parse(from, formatter);
-            LocalDate toDate = to != null ? LocalDate.parse(to, formatter) : null;
-            return manager.getUserCalendar(id, fromDate, toDate, Status.getStatus(status));
-        });
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
+        LocalDate fromDate = LocalDate.parse(from, formatter);
+        LocalDate toDate = to != null ? LocalDate.parse(to, formatter) : null;
+        return manager.getUserCalendar(id, fromDate, toDate, Status.getStatus(status));
     }
 
     @RequestMapping(value = "/settings", method=GET)
-    public ResponseEntity settings(
+    public DefaultSettings settings(
             @RequestParam(value = "lang", required = false) String lang)
     {
-        return handle(Language.getLanguage(lang), () -> new DefaultSettings(manager.getDefaultSettings()));
+        return new DefaultSettings(manager.getDefaultSettings());
     }
 
     // *********************** POST ****************************
 
     @RequestMapping(value = "/settings", method=POST)
-    public ResponseEntity settings(
+    public ResponseEntity<Void> settings(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestBody DefaultSettings settings)
     {
-        return handle(Language.getLanguage(lang), () ->
-                manager.createSettings(settings.toEntity())
-        );
+        manager.createSettings(settings.toEntity());
+
+        return ResponseEntity.ok().build();
     }
 
     @RequestMapping(value = "/user/calendar/create", method=POST)
-    public ResponseEntity userCalendarCreate(
+    public ResponseEntity<Void> userCalendarCreate(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestBody VacationDay vacationDay,
             Authentication auth)
     {
         //TODO make api endpoint contain userId in path as part of #39, also drop the create part of path
         //TODO drop the auth parameter afterwards
-        return handle(Language.getLanguage(lang), () ->
-                manager.createVacation(((User) auth.getPrincipal()).getId(), vacationDay)
-        );
+        manager.createVacation(((User) auth.getPrincipal()).getId(), vacationDay);
+
+        return ResponseEntity.ok().build();
     }
 
     // *********************** PUT ****************************
 
 
     @RequestMapping(value = "/user/settings", method=PUT)
-    public ResponseEntity userSettings(
+    public ResponseEntity<Void> userSettings(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestBody UserSettings settings,
             Authentication auth)
     {
         //TODO make api endpoint contain userId in path as part of #39
         //TODO drop the auth parameter afterwards
-        return handle(Language.getLanguage(lang), () ->
-                manager.changeSettings(((User) auth.getPrincipal()).getId(), settings)
-        );
+        manager.changeSettings(((User) auth.getPrincipal()).getId(), settings);
+
+        return ResponseEntity.ok().build();
     }
 
     @RequestMapping(value = "/user/calendar/edit", method=PUT)
-    public ResponseEntity userCalendarEdit(
+    public ResponseEntity<Void> userCalendarEdit(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestBody VacationDay vacationDay)
     {
         //TODO make api endpoint point to vacation endpoint as part of #39, also drop the edit part of path
         //TODO drop the auth parameter afterwards
-        return handle(Language.getLanguage(lang), () ->
-                manager.changeVacation(vacationDay)
-        );
+        manager.changeVacation(vacationDay);
+
+        return ResponseEntity.ok().build();
     }
 
     @RequestMapping(value = "/user/requests", method=PUT)
-    public ResponseEntity userRequests(
+    public ResponseEntity<Void> userRequests(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestParam(value = "type", required = true) String type,
             @RequestBody BasicRequest request)
     {
-        return handle(Language.getLanguage(lang), () ->
-                manager.changeRequest(RequestType.getType(type), request)
-        );
+        manager.changeRequest(RequestType.getType(type), request);
+
+        return ResponseEntity.ok().build();
     }
 
     // *********************** DELETE ****************************
 
     @RequestMapping(value = "/calendar/{id}/delete", method=DELETE)
-    public ResponseEntity calendarDelete(
+    public ResponseEntity<Void> calendarDelete(
             @PathVariable("id") Long id,
             @RequestParam(value = "lang", required = false) String lang)
     {
-        return handle(Language.getLanguage(lang), () ->
-                manager.deleteVacation(id)
-        );
+        manager.deleteVacation(id);
+
+        return ResponseEntity.ok().build();
     }
 
     // *********************** FILE ****************************
 
     @RequestMapping(value = "/import/xls", method=POST)
-    public ResponseEntity importXLSFile(
-            @RequestParam(value = "lang", required = false) String lang,
-            @RequestParam("file") MultipartFile file)
-    {
-        return handle(Language.getLanguage(lang), () ->
-            fileService.parseXLSFile(file.getOriginalFilename(), file.getBytes())
-        );
+    public ResponseEntity<Void> importXLSFile(@RequestParam(value = "lang", required = false) String lang, @RequestParam("file") MultipartFile file) throws Exception {
+        fileService.parseXLSFile(file.getOriginalFilename(), file.getBytes());
+
+        return ResponseEntity.ok().build();
     }
 
     @RequestMapping(value = "/export/pdf", method=GET)
-    public ResponseEntity exportPDFFile(
-            @RequestParam(value = "lang", required = false) String lang)
-    {
-        return handle(Language.getLanguage(lang),
-                () -> fileService.createPDFFile(),
-                (res) -> new String[]{HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + res.getName() + "\""},
-                (res) -> res.getBytes()
-        );
+    public ResponseEntity<byte[]> exportPDFFile(@RequestParam(value = "lang", required = false) String lang) throws Exception {
+        FileExportResult result = fileService.createPDFFile();
+
+        return ResponseEntity.ok()
+                .header(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=\"%s\"", result.getName()))
+                .body(result.getBytes());
     }
 }
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/BaseController.java b/server/src/main/java/org/danekja/ymanager/ws/rest/BaseController.java
deleted file mode 100644
index 25ddf88..0000000
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/BaseController.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.danekja.ymanager.ws.rest;
-
-import org.danekja.ymanager.util.localization.Language;
-import org.danekja.ymanager.util.localization.Message;
-import org.danekja.ymanager.ws.rest.exceptions.RESTFullException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Function;
-
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.ResponseEntity.ok;
-
-public abstract class BaseController {
-
-    protected final Logger LOG = LoggerFactory.getLogger(this.getClass());
-
-    protected <T> ResponseEntity handle(Language language, RESTGetHandler<T> handler) {
-        return handle(language, handler, null, null);
-    }
-
-    protected <T> ResponseEntity handle(Language language, RESTGetHandler<T> handler, Function<T, String[]> header, Function<T, Object> bodyValue) {
-        try {
-            T result = handler.get();
-
-            ResponseEntity.BodyBuilder response = ResponseEntity.ok();
-
-            if (header != null) {
-                String[] headers = header.apply(result);
-
-                if (headers.length > 1) {
-                    response.header(headers[0], Arrays.copyOfRange(headers, 1, headers.length - 1));
-                } else if (headers.length == 1) {
-                    response.header(headers[0]);
-                }
-            }
-
-            return response.body(bodyValue != null ? bodyValue.apply(result) : result);
-
-        } catch (RESTFullException e) {
-            LOG.error(e.getMessage());
-            return sendError(400, e.getLocalizedMessage(), language);
-        } catch (Exception e) {
-            LOG.error(e.getMessage());
-            return sendError(401, "rest.exception.generic", language);
-        }
-    }
-
-    protected ResponseEntity sendError(Integer errorCode, String messageKey, Language language) {
-        String localizedMessage = Message.getString(language, messageKey);
-        Map<String, String> result = new HashMap<>();
-        result.put("error", errorCode.toString());
-        result.put("message", localizedMessage);
-        return ResponseEntity.status(errorCode).contentType(MediaType.APPLICATION_JSON).body(result);
-    }
-
-    protected <T> ResponseEntity handle(Language language, RESTInvokeHandler<T> handler) {
-        try {
-            handler.invoke();
-            return ok(OK);
-        } catch (RESTFullException e) {
-            LOG.error(e.getMessage());
-            return sendError(400, e.getLocalizedMessage(), language);
-        } catch (Exception e) {
-            LOG.error(e.getMessage());
-            return sendError(401, e.getMessage(), language);
-        }
-    }
-}
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/CustomExceptionHandler.java b/server/src/main/java/org/danekja/ymanager/ws/rest/CustomExceptionHandler.java
new file mode 100644
index 0000000..76633c6
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/ws/rest/CustomExceptionHandler.java
@@ -0,0 +1,101 @@
+package org.danekja.ymanager.ws.rest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.server.ResponseStatusException;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@ControllerAdvice
+public class CustomExceptionHandler extends ResponseEntityExceptionHandler {
+    @ExceptionHandler(DataAccessException.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleDataAccessException(DataAccessException ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.error(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        Map<String, String> result = new HashMap<>();
+        result.put("message", ex.getMessage());
+
+        return super.handleExceptionInternal(ex, result, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
+    }
+
+    @ExceptionHandler(EmptyResultDataAccessException.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleEmptyResultDataAccessException(EmptyResultDataAccessException ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.debug(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        return super.handleExceptionInternal(ex, null, new HttpHeaders(), HttpStatus.NOT_FOUND, request);
+    }
+
+    @ExceptionHandler(IllegalArgumentException.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleIllegalArgumentException(IllegalArgumentException ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.debug(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        Map<String, String> result = new HashMap<>();
+        result.put("message", ex.getMessage());
+
+        return super.handleExceptionInternal(ex, result, new HttpHeaders(), HttpStatus.BAD_REQUEST, request);
+    }
+
+    @ExceptionHandler(AccessDeniedException.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleAccessDeniedException(AccessDeniedException ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.error(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        Map<String, String> result = new HashMap<>();
+        result.put("message", ex.getMessage());
+
+        return super.handleExceptionInternal(ex, result, new HttpHeaders(), HttpStatus.FORBIDDEN, request);
+    }
+
+    @ExceptionHandler(ResponseStatusException.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleResponseStatusException(ResponseStatusException ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.error(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        Map<String, String> result = new HashMap<>();
+        result.put("message", ex.getReason());
+
+        return super.handleExceptionInternal(ex, result, new HttpHeaders(), ex.getStatus(), request);
+    }
+
+    @ExceptionHandler(Exception.class)
+    @ResponseBody
+    public final ResponseEntity<Object> handleAll(Exception ex, WebRequest request) {
+        Logger log = getExceptionLogger(ex);
+        log.error(ex.getMessage());
+        log.debug(ex.getMessage(), ex);
+
+        Map<String, String> result = new HashMap<>();
+        result.put("message", ex.getMessage());
+
+        return super.handleExceptionInternal(ex, result, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
+    }
+
+    protected Logger getExceptionLogger(Exception ex) {
+        return LoggerFactory.getLogger(ex.getStackTrace()[0].getClassName());
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/RESTGetHandler.java b/server/src/main/java/org/danekja/ymanager/ws/rest/RESTGetHandler.java
deleted file mode 100644
index e1ae9c6..0000000
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/RESTGetHandler.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.danekja.ymanager.ws.rest;
-
-import java.lang.FunctionalInterface;
-
-@FunctionalInterface
-public interface RESTGetHandler<T> {
-    T get() throws Exception;
-}
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/RESTInvokeHandler.java b/server/src/main/java/org/danekja/ymanager/ws/rest/RESTInvokeHandler.java
deleted file mode 100644
index 85a734f..0000000
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/RESTInvokeHandler.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.danekja.ymanager.ws.rest;
-
-@FunctionalInterface
-public interface RESTInvokeHandler<T> {
-    void invoke() throws Exception;
-}
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/UserController.java b/server/src/main/java/org/danekja/ymanager/ws/rest/UserController.java
index 411bab7..1076801 100644
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/UserController.java
+++ b/server/src/main/java/org/danekja/ymanager/ws/rest/UserController.java
@@ -3,21 +3,21 @@ package org.danekja.ymanager.ws.rest;
 import org.danekja.ymanager.business.UserManager;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.User;
+import org.danekja.ymanager.dto.BasicProfileUser;
 import org.danekja.ymanager.dto.FullUserProfile;
-import org.danekja.ymanager.util.localization.Language;
-import org.danekja.ymanager.ws.rest.exceptions.NotFoundException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * Controller for Users collection of WS API.
  */
 @RestController
 @RequestMapping("/users")
-public class UserController extends BaseController {
+public class UserController {
 
     private final UserManager userManager;
 
@@ -27,12 +27,10 @@ public class UserController extends BaseController {
     }
 
     @GetMapping
-    public ResponseEntity users(
+    public List<BasicProfileUser> users(
             @RequestParam(value = "lang", required = false) String lang,
             @RequestParam(value = "status", required = false) String status) {
-        return handle(Language.getLanguage(lang), () ->
-                userManager.getUsers(Status.getStatus(status))
-        );
+        return userManager.getUsers(Status.getStatus(status));
     }
 
 
@@ -58,10 +56,6 @@ public class UserController extends BaseController {
     public FullUserProfile getUserProfile(@PathVariable("id") Long id) throws Exception {
         User u = userManager.getUser(id);
 
-        if (u == null) {
-            throw new NotFoundException();
-        }
-
         return new FullUserProfile(u);
     }
 }
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/NotFoundException.java b/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/NotFoundException.java
deleted file mode 100644
index 0f77ad1..0000000
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/NotFoundException.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.danekja.ymanager.ws.rest.exceptions;
-
-public class NotFoundException extends Exception {
-}
diff --git a/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/RESTFullException.java b/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/RESTFullException.java
deleted file mode 100644
index fd48d73..0000000
--- a/server/src/main/java/org/danekja/ymanager/ws/rest/exceptions/RESTFullException.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.danekja.ymanager.ws.rest.exceptions;
-
-public class RESTFullException extends Exception {
-
-    private final String messageKey;
-
-    public RESTFullException(String message, String messageKey) {
-        super(message);
-        this.messageKey = messageKey;
-    }
-
-    @Override
-    public String getLocalizedMessage() {
-        return messageKey;
-    }
-}
