@ExceptionHandler(Exception.class)
    public ResponseEntity<ErrorResponse> handleGenericException(Exception ex) {
        ErrorResponse error = new ErrorResponse(
            "Internal_Error", 
            "An unexpected error occurred: " + ex.getMessage(),
            "Please try again later or contact support if the issue persists.");
        
        return new ResponseEntity<>(error, HttpStatus.INTERNAL_SERVER_ERROR);
    }
Handle generic exceptions that are not specifically handled elsewhere.

@param ex The exception that was thrown
@return A response with error details
03-GettingStarted/samples/java/calculator/src/main/java/com/microsoft/mcp/sample/server/exception/GlobalExceptionHandler.java