class AbstractExceptionAwareLogic {

    private String errorUrl;

    /**
     * Handle exceptions.
     *
     * @param e the thrown exception
     * @param httpActionAdapter the HTTP action adapter
     * @param context the web context
     * @return the final HTTP result
     */
    protected Object handleException(final Exception e, final HttpActionAdapter httpActionAdapter, final WebContext context) {<FILL_FUNCTION_BODY>}

    /**
     * Wrap an Exception into a RuntimeException.
     *
     * @param exception the original exception
     * @return the RuntimeException
     */
    protected RuntimeException runtimeException(final Exception exception) {
        if (exception instanceof RuntimeException runtimeException) {
            throw runtimeException;
        } else {
            throw new RuntimeException(exception);
        }
    }

    /**
     * <p>buildContext.</p>
     *
     * @param config a {@link Config} object
     * @param parameters a {@link FrameworkParameters} object
     * @return a {@link CallContext} object
     */
    protected CallContext buildContext(final Config config, final FrameworkParameters parameters) {
        assertNotNull("config", config);

        assertNotNull("config.getWebContextFactory()", config.getWebContextFactory());
        val webContext = config.getWebContextFactory().newContext(parameters);
        assertNotNull("context", webContext);

        assertNotNull("config.getSessionStoreFactory()", config.getSessionStoreFactory());
        val sessionStore = config.getSessionStoreFactory().newSessionStore(parameters);
        assertNotNull("sessionStore", sessionStore);

        val profileManagerFactory = config.getProfileManagerFactory();
        assertNotNull("profileManagerFactory", profileManagerFactory);

        return new CallContext(webContext, sessionStore, profileManagerFactory);
    }
}

        if (httpActionAdapter == null || context == null) {
            throw runtimeException(e);
        } else if (e instanceof HttpAction httpAction) {
            LOGGER.debug("extra HTTP action required in security: {}", httpAction.getCode());
            return httpActionAdapter.adapt(httpAction, context);
        } else {
            if (CommonHelper.isNotBlank(errorUrl)) {
                val action = HttpActionHelper.buildRedirectUrlAction(context, errorUrl);
                return httpActionAdapter.adapt(action, context);
            } else {
                throw runtimeException(e);
            }
        }
    
<no_super_class>