// Path: service/src/main/java/info/rolandkrueger/userservice/model/ServiceError.java
// public class ServiceError {
//     private String error;
//     private String message;
// 
//     public ServiceError(Exception exception) {
//         this.message = exception.getMessage();
//         this.error = exception.getClass().getSimpleName();
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// }


import info.rolandkrueger.userservice.model.ServiceError;
import org.springframework.http.HttpStatus;
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.bind.annotation.ResponseStatus;
import javax.ws.rs.NotFoundException;
package info.rolandkrueger.userservice.application;



/**
 * @author Roland Krüger
 */
@ControllerAdvice
public class GlobalControllerExceptionHandler {

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(HttpStatus.NOT_FOUND)
    @ResponseBody
// Path: service/src/main/java/info/rolandkrueger/userservice/model/ServiceError.java
// public class ServiceError {
//     private String error;
//     private String message;
// 
//     public ServiceError(Exception exception) {
//         this.message = exception.getMessage();
//         this.error = exception.getClass().getSimpleName();
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// }


// Path: service/src/main/java/info/rolandkrueger/userservice/application/GlobalControllerExceptionHandler.java
import info.rolandkrueger.userservice.model.ServiceError;
import org.springframework.http.HttpStatus;
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.bind.annotation.ResponseStatus;
import javax.ws.rs.NotFoundException;

package info.rolandkrueger.userservice.application;



/**
 * @author Roland Krüger
 */
@ControllerAdvice
public class GlobalControllerExceptionHandler {

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(HttpStatus.NOT_FOUND)
    @ResponseBody
    public ServiceError handleNotFoundException(NotFoundException notFoundException) {