propagate name resolution exceptions in the correct thread context

Sorry for spam, this is duplicate of #12