- Full Java 21 + Spring Boot 3.3 backend with Virtual Threads - HikariCP connection pool for Oracle ADB - JWT auth, Redis caching, OCI GenAI integration - YouTube transcript extraction via API + Playwright browser fallback - SSE streaming for bulk operations - Scheduled daemon for channel scanning/video processing - Mobile UI: collapse restaurant list to single row on selection - Switch PM2 ecosystem config to Java backend Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
1.1 KiB
Java
31 lines
1.1 KiB
Java
package com.tasteby.config;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
import org.springframework.web.server.ResponseStatusException;
|
|
|
|
import java.util.Map;
|
|
|
|
@RestControllerAdvice
|
|
public class GlobalExceptionHandler {
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
|
|
|
@ExceptionHandler(ResponseStatusException.class)
|
|
public ResponseEntity<Map<String, Object>> handleStatus(ResponseStatusException ex) {
|
|
return ResponseEntity.status(ex.getStatusCode())
|
|
.body(Map.of("detail", ex.getReason() != null ? ex.getReason() : "Error"));
|
|
}
|
|
|
|
@ExceptionHandler(Exception.class)
|
|
public ResponseEntity<Map<String, Object>> handleGeneral(Exception ex) {
|
|
log.error("Unhandled exception", ex);
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
.body(Map.of("detail", "Internal server error"));
|
|
}
|
|
}
|