@Override
    public GoApiResponse submit(final GoApiRequest request) {
        if (requestProcessorRegistry.canProcess(request)) {
            try {
                GoPluginApiRequestProcessor processor = requestProcessorRegistry.processorFor(request);
                return processor.process(pluginDescriptor, request);
            } catch (Exception e) {
                LOGGER.warn("Error while processing request api [{}]", request.api(), e);
                throw new RuntimeException(String.format("Error while processing request api %s", request.api()), e);
            }
        }
        LOGGER.warn("Plugin {} sent a request that could not be understood {} at version {}", request.pluginIdentifier().getExtension(), request.api(), request.apiVersion());
        return unhandledApiRequest();
    }
@Test
    void shouldHandleExceptionThrownByProcessor() {
        String api = "api-uri";
        GoPluginApiRequestProcessor processor = mock(GoPluginApiRequestProcessor.class);
        GoApiRequest goApiRequest = mock(GoApiRequest.class);
        GoPluginDescriptor descriptor = mock(GoPluginDescriptor.class);
        when(goApiRequest.api()).thenReturn(api);
        Throwable cause = new RuntimeException("error");
        when(processor.process(descriptor, goApiRequest)).thenThrow(cause);

        PluginRequestProcessorRegistry pluginRequestProcessorRegistry = new PluginRequestProcessorRegistry();
        pluginRequestProcessorRegistry.registerProcessorFor(api, processor);
        PluginAwareDefaultGoApplicationAccessor accessor = new PluginAwareDefaultGoApplicationAccessor(descriptor, pluginRequestProcessorRegistry);

        assertThatCode(() -> accessor.submit(goApiRequest))
                .hasMessage(String.format("Error while processing request api %s", api))
                .hasCause(cause);
    }