C0urante commented on code in PR #13148:
URL: https://github.com/apache/kafka/pull/13148#discussion_r1084283540


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java:
##########
@@ -821,13 +827,14 @@ public List<ConfigKeyInfo> connectorPluginConfig(String 
pluginName) {
                 default:
                     throw new BadRequestException("Invalid plugin type " + 
pluginType + ". Valid types are sink, source, converter, header_converter, 
transformation, predicate.");
             }
-        } catch (ClassNotFoundException cnfe) {
-            throw new NotFoundException("Unknown plugin " + pluginName + ".");
-        }
-        for (ConfigDef.ConfigKey configKey : configDefs.configKeys().values()) 
{
-            results.add(AbstractHerder.convertConfigKey(configKey));
+            List<ConfigKeyInfo> results = new ArrayList<>();
+            for (ConfigDef.ConfigKey configKey : 
configDefs.configKeys().values()) {
+                results.add(AbstractHerder.convertConfigKey(configKey));
+            }
+            return results;
+        } catch (ClassNotFoundException e) {
+            throw new ConnectException("Failed to load plugin class or one of 
its dependencies", e);

Review Comment:
   IMO an HTTP 500 response (which will be the result of throwing a 
`ConnectException` here) is more warranted in this place since we've already 
checked to see that the plugin type is recognized on the worker by this point. 
If things break here, it's more likely that the worker or one of its plugins is 
set up or packaged incorrectly than that the user issued a bad request.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to