catch lastError cleanly in current context