// Path: src/main/java/com/lyubenblagoev/postfixrest/BadRequestException.java
// public class BadRequestException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 540536621916319350L;
// 
// 	public BadRequestException() {
// 	}
// 
// 	public BadRequestException(String message) {
// 		super(message);
// 	}
// 
// 	public BadRequestException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public BadRequestException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public BadRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -1967579868614870552L;
// 
// 	public NotFoundException() {
// 	}
// 
// 	public NotFoundException(String message) {
// 		super(message);
// 	}
// 
// 	public NotFoundException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public NotFoundException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public NotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/service/EntityExistsException.java
// public class EntityExistsException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 4861593009857124251L;
// 
// 	public EntityExistsException() {
// 	}
// 
// 	public EntityExistsException(String message) {
// 		super(message);
// 	}
// 
// 	public EntityExistsException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public EntityExistsException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public EntityExistsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }


import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import com.lyubenblagoev.postfixrest.BadRequestException;
import com.lyubenblagoev.postfixrest.NotFoundException;
import com.lyubenblagoev.postfixrest.service.EntityExistsException;
package com.lyubenblagoev.postfixrest.controller;




@ControllerAdvice
public class ExceptionHandlerAdvice {
	
	private static final Logger log = LoggerFactory.getLogger(ExceptionHandlerAdvice.class); 

	@ExceptionHandler(NotFoundException.class)
	private ResponseEntity<ApiErrorResponse> notFoundExceptionHandler(HttpServletRequest request, Exception exception) {
		return handleException(exception, request, HttpStatus.NOT_FOUND);
	}

// Path: src/main/java/com/lyubenblagoev/postfixrest/BadRequestException.java
// public class BadRequestException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 540536621916319350L;
// 
// 	public BadRequestException() {
// 	}
// 
// 	public BadRequestException(String message) {
// 		super(message);
// 	}
// 
// 	public BadRequestException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public BadRequestException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public BadRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -1967579868614870552L;
// 
// 	public NotFoundException() {
// 	}
// 
// 	public NotFoundException(String message) {
// 		super(message);
// 	}
// 
// 	public NotFoundException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public NotFoundException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public NotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/service/EntityExistsException.java
// public class EntityExistsException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 4861593009857124251L;
// 
// 	public EntityExistsException() {
// 	}
// 
// 	public EntityExistsException(String message) {
// 		super(message);
// 	}
// 
// 	public EntityExistsException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public EntityExistsException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public EntityExistsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// }


// Path: src/main/java/com/lyubenblagoev/postfixrest/controller/ExceptionHandlerAdvice.java
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import com.lyubenblagoev.postfixrest.BadRequestException;
import com.lyubenblagoev.postfixrest.NotFoundException;
import com.lyubenblagoev.postfixrest.service.EntityExistsException;

package com.lyubenblagoev.postfixrest.controller;




@ControllerAdvice
public class ExceptionHandlerAdvice {
	
	private static final Logger log = LoggerFactory.getLogger(ExceptionHandlerAdvice.class); 

	@ExceptionHandler(NotFoundException.class)
	private ResponseEntity<ApiErrorResponse> notFoundExceptionHandler(HttpServletRequest request, Exception exception) {
		return handleException(exception, request, HttpStatus.NOT_FOUND);
	}

	@ExceptionHandler(BadRequestException.class)