com.vilt.minium.app.controller.ConsoleControllerHandler Maven / Gradle / Ivy
/*
* Copyright (C) 2013 The Minium Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vilt.minium.app.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class ConsoleControllerHandler {
private static final Logger logger = LoggerFactory.getLogger(ConsoleControllerHandler.class);
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity handleResourceNotFoundException(ResourceNotFoundException e) {
return new ResponseEntity(HttpStatus.NOT_FOUND);
}
@ExceptionHandler(Exception.class)
public ResponseEntity handleException(Exception e) {
logger.error(e.getMessage(), e);
return new ResponseEntity(e, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy