{"action":"closed","issue":{"url":"https://api.github.com/repos/benlau/asyncfuture/issues/5","repository_url":"https://api.github.com/repos/benlau/asyncfuture","labels_url":"https://api.github.com/repos/benlau/asyncfuture/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/benlau/asyncfuture/issues/5/comments","events_url":"https://api.github.com/repos/benlau/asyncfuture/issues/5/events","html_url":"https://github.com/benlau/asyncfuture/issues/5","id":294777393,"number":5,"title":"Exception Handling","user":{"login":"daniel-adb-fa","id":18716653,"avatar_url":"https://avatars2.githubusercontent.com/u/18716653?v=4","gravatar_id":"","url":"https://api.github.com/users/daniel-adb-fa","html_url":"https://github.com/daniel-adb-fa","followers_url":"https://api.github.com/users/daniel-adb-fa/followers","following_url":"https://api.github.com/users/daniel-adb-fa/following{/other_user}","gists_url":"https://api.github.com/users/daniel-adb-fa/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-adb-fa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-adb-fa/subscriptions","organizations_url":"https://api.github.com/users/daniel-adb-fa/orgs","repos_url":"https://api.github.com/users/daniel-adb-fa/repos","events_url":"https://api.github.com/users/daniel-adb-fa/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-adb-fa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-06T14:24:20Z","updated_at":"2018-03-15T09:07:08Z","closed_at":"2018-03-15T09:07:08Z","author_association":"NONE","body":"It may be a good idea to add exception handling in a way similar to QtConcurrent.\r\n\r\nSomething like the following patch may do the trick:\r\n\r\n```\r\n---------------------- 3rdparty/asyncfuture/asyncfuture.h ----------------------\r\nindex 9abf14e..a658653 100644\r\n@@ -960,18 +960,23 @@ eval(Functor functor, QFuture<T> future) {\r\n template <typename DeferredType, typename RetType, typename T, typename Completed, typename Canceled>\r\n static DeferredFuture<DeferredType>* execute(QFuture<T> future, QObject* contextObject, Completed onCompleted, Canceled onCanceled) {\r\n \r\n     DeferredFuture<DeferredType>* defer = new DeferredFuture<DeferredType>();\r\n     defer->autoDelete = true;\r\n     watch(future,\r\n           contextObject,\r\n           contextObject,[=]() {\r\n-        Value<RetType> value = eval(onCompleted, future);\r\n-        defer->complete(value);\r\n+\t\ttry {\r\n+\t\t\tValue<RetType> value = eval(onCompleted, future);\r\n+\t\t\tdefer->complete(value);\r\n+\t\t} catch(const QException& e) {\r\n+\t\t\tdefer->reportException(e);\r\n+\t\t} catch(const std::exception&) {\r\n+\t\t\tdefer->reportException(QUnhandledException());\r\n     }, [=]() {\r\n         onCanceled();\r\n         defer->cancel();\r\n     });\r\n \r\n     if (contextObject) {\r\n         defer->cancel(contextObject, &QObject::destroyed);\r\n     }\r\n\r\n```"}}
{"actor":{"display_login":"daniel-adb-fa"}}