Class CustomErrorController
java.lang.Object
springboot.bg.harisauto.common.exception.CustomErrorController
- All Implemented Interfaces:
org.springframework.boot.web.servlet.error.ErrorController
@Controller
public class CustomErrorController
extends Object
implements org.springframework.boot.web.servlet.error.ErrorController
CustomErrorController.java - Renders the branded error pages for container-level errors.
@ControllerAdvice only sees exceptions thrown out of a handler. Anything the
container raises on its own - an unmapped URL, a request to a static path that does not
exist, an error forwarded after the response has begun - lands on /error instead,
which without this controller renders Spring Boot's whitelabel page.
- Author:
- Kristian Popov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.ModelAndViewhandleError(jakarta.servlet.http.HttpServletRequest request) Renders an error page appropriate to the status the container recorded.
-
Constructor Details
-
CustomErrorController
public CustomErrorController()
-
-
Method Details
-
handleError
@RequestMapping("/error") public org.springframework.web.servlet.ModelAndView handleError(jakarta.servlet.http.HttpServletRequest request) Renders an error page appropriate to the status the container recorded.- Parameters:
request- The failed request.- Returns:
- The 404 view for missing pages, the generic error view otherwise.
-