Copilot commented on code in PR #6387:
URL: https://github.com/apache/ignite-3/pull/6387#discussion_r2260933120
##########
migration-tools/modules/migration-tools-persistence/src/main/java/org/apache/ignite/migrationtools/persistence/Ignite2PersistentCacheTools.java:
##########
@@ -206,6 +210,24 @@ public static void migrateCache(
schema,
columnToFieldMappings,
StaticTypeConverterFactory.DEFAULT_INSTANCE))
+ .map(itemPublisher -> {
+ var p = new
BasicProcessor<DataStreamerItem<Map.Entry<Tuple, Tuple>>,
+ DataStreamerItem<Map.Entry<Tuple,
Tuple>>>() {
+ @Override
+ public void
onNext(DataStreamerItem<Entry<Tuple, Tuple>> item) {
+ subscriber.onNext(item);
+ }
+
+ @Override
+ public void onError(Throwable throwable) {
+ super.onError(new
MigrateCacheException(cacheName, tableName, throwable));
+ }
+ };
+
Review Comment:
[nitpick] The anonymous class implementation could be simplified or
extracted to a separate method to improve readability and maintainability. The
nested anonymous class structure makes the code harder to follow.
```suggestion
var p = new
DataStreamerItemForwardingProcessor(subscriber, cacheName, tableName);
```
##########
migration-tools/modules/migration-tools-cli/src/main/java/org/apache/ignite/migrationtools/cli/exceptions/DataStreamerExceptionHandler.java:
##########
@@ -17,18 +17,36 @@
package org.apache.ignite.migrationtools.cli.exceptions;
+import
org.apache.ignite.migrationtools.persistence.exceptions.MigrateCacheException;
import
org.apache.ignite.migrationtools.persistence.mappers.RecordAndTableSchemaMismatchException;
import org.apache.ignite3.internal.cli.core.exception.ExceptionHandler;
import org.apache.ignite3.internal.cli.core.exception.ExceptionWriter;
+import org.apache.ignite3.internal.cli.core.style.component.ErrorUiComponent;
import org.apache.ignite3.table.DataStreamerException;
/** DataStreamerExceptionHandler. */
public class DataStreamerExceptionHandler implements
ExceptionHandler<DataStreamerException> {
@Override
public int handle(ExceptionWriter writer, DataStreamerException e) {
- if (e.getCause() instanceof RecordAndTableSchemaMismatchException) {
- return
RecordAndTableSchemaMismatchExceptionHandler.INSTANCE.handle(
- writer, (RecordAndTableSchemaMismatchException)
e.getCause());
+ if (e.getCause() instanceof MigrateCacheException) {
+ MigrateCacheException mce = (MigrateCacheException) e.getCause();
+
+ String details;
+ if (e.getCause().getCause() instanceof
RecordAndTableSchemaMismatchException) {
+ RecordAndTableSchemaMismatchException rme =
(RecordAndTableSchemaMismatchException) mce.getCause();
+ details =
RecordAndTableSchemaMismatchExceptionHandler.details(rme);
+ } else {
+ details = "Unknown error. Check the logs folder for more
information.";
Review Comment:
The error message is too generic and doesn't provide actionable information.
Consider including the actual exception type or a more specific message, such
as 'Unexpected error during migration: [exception type]. Check the logs folder
for detailed information.'
```suggestion
Throwable cause = mce.getCause();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]