Create a custom error when plugin is not found. (#409)

Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
pull/412/head
Abdelhamid Bakhta 5 years ago committed by GitHub
parent c38152abf0
commit 8afd6516e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/PluginsReloadConfiguration.java
  2. 5
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java

@ -52,7 +52,7 @@ public class PluginsReloadConfiguration implements JsonRpcMethod {
"Plugin cannot be reloaded because no plugin has been registered with specified name: {}.",
pluginName);
return new JsonRpcErrorResponse(
requestContext.getRequest().getId(), JsonRpcError.INTERNAL_ERROR);
requestContext.getRequest().getId(), JsonRpcError.PLUGIN_NOT_FOUND);
}
reloadPluginConfig(namedPlugins.get(pluginName));
return new JsonRpcSuccessResponse(requestContext.getRequest().getId());

@ -150,7 +150,10 @@ public enum JsonRpcError {
ENCLAVE_PRIVACY_GROUP_MISSING(-50200, "PrivacyGroupNotFound"),
ENCLAVE_PRIVACY_QUERY_ERROR(-50200, "PrivacyGroupQueryError"),
ENCLAVE_KEYS_CANNOT_DECRYPT_PAYLOAD(-50200, "EnclaveKeysCannotDecryptPayload"),
METHOD_UNIMPLEMENTED(-50200, "MethodUnimplemented");
METHOD_UNIMPLEMENTED(-50200, "MethodUnimplemented"),
/** Plugins error */
PLUGIN_NOT_FOUND(-60000, "Plugin not found");
private final int code;
private final String message;

Loading…
Cancel
Save