content: package com.codeages.termiusplus.exception;
  
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
  import org.springframework.boot.web.error.ErrorAttributeOptions;
  import org.springframework.boot.web.servlet.error.ErrorAttributes;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  import jakarta.servlet.http.HttpServletRequest;
  import java.util.Map;
  
  @Slf4j
  @RestController
  @RequestMapping({GlobalErrorController.ERROR_PATH})
  public class GlobalErrorController extends AbstractErrorController {
  
      static final String ERROR_PATH = "/error";
  
      public GlobalErrorController(ErrorAttributes errorAttributes) {
          super(errorAttributes);
      }
  
      @RequestMapping
      public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
  
          Map<String, Object> body = this.getErrorAttributes(request, ErrorAttributeOptions.defaults());
          HttpStatus status = this.getStatus(request);
  
          return new ResponseEntity<>(body, status);
      }
  
  }
  