Handle non-JS-provided error handlers when generating a config from a sync session (#1616)
This commit is contained in:
parent
676eca6bf9
commit
f77a87171f
|
@ -390,9 +390,10 @@ void SessionClass<T>::get_config(ContextType ctx, ObjectType object, ReturnValue
|
||||||
ObjectType config = Object::create_empty(ctx);
|
ObjectType config = Object::create_empty(ctx);
|
||||||
Object::set_property(ctx, config, "user", create_object<T, UserClass<T>>(ctx, new SharedUser(session->config().user)));
|
Object::set_property(ctx, config, "user", create_object<T, UserClass<T>>(ctx, new SharedUser(session->config().user)));
|
||||||
Object::set_property(ctx, config, "url", Value::from_string(ctx, session->config().realm_url()));
|
Object::set_property(ctx, config, "url", Value::from_string(ctx, session->config().realm_url()));
|
||||||
if (auto* dispatcher = session->config().error_handler.template target<EventLoopDispatcher<SyncSessionErrorHandler>>()) {
|
if (auto dispatcher = session->config().error_handler.template target<EventLoopDispatcher<SyncSessionErrorHandler>>()) {
|
||||||
auto& handler = *dispatcher->func().template target<SyncSessionErrorHandlerFunctor<T>>();
|
if (auto handler = dispatcher->func().template target<SyncSessionErrorHandlerFunctor<T>>()) {
|
||||||
Object::set_property(ctx, config, "error", handler.func());
|
Object::set_property(ctx, config, "error", handler->func());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return_value.set(config);
|
return_value.set(config);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue