Skip to content

Commit

Permalink
fix(TCOMP-2710): send notice that schema is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
undx committed Jun 25, 2024
1 parent b9e8d63 commit 507f8bc
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static org.talend.sdk.component.api.exception.DiscoverSchemaException.HandleErrorWith.EXCEPTION;
import static org.talend.sdk.component.api.exception.DiscoverSchemaException.HandleErrorWith.EXECUTE_LIFECYCLE;
import static org.talend.sdk.component.api.record.SchemaProperty.IS_KEY;
import static org.talend.sdk.component.api.record.SchemaProperty.PATTERN;
Expand Down Expand Up @@ -167,8 +168,7 @@ private DiscoverSchemaException transformException(final Exception e) {
} else if (e instanceof ComponentException) {
discoverSchemaException = new DiscoverSchemaException((ComponentException) e);
} else {
discoverSchemaException = new DiscoverSchemaException(e.getMessage(), e.getStackTrace(),
DiscoverSchemaException.HandleErrorWith.EXCEPTION);
discoverSchemaException = new DiscoverSchemaException(e.getMessage(), e.getStackTrace(), EXCEPTION);
}
return discoverSchemaException;
}
Expand Down Expand Up @@ -243,7 +243,12 @@ private void executeDiscoverSchemaExtendedAction(final Schema schema, final Stri
final Object schemaResult =
actionRef.getInvoker().apply(buildActionConfig(actionRef, configuration, schema, branch));
if (schemaResult instanceof Schema) {
fromSchema(Schema.class.cast(schemaResult));
final Schema result = (Schema) schemaResult;
if (result.getEntries().isEmpty()) {
throw new DiscoverSchemaException(ERROR_NO_AVAILABLE_SCHEMA_FOUND, EXCEPTION);
} else {
fromSchema(Schema.class.cast(schemaResult));
}
}
}

Expand Down

0 comments on commit 507f8bc

Please sign in to comment.