Fixed \XF::asVisitor & exception handling

Affected version
2.0 DP10


Well-known member
\XF::asVisitor doesn't restore the visitor object when an exception is throw, which can lead to miss-leading impression on what the user session is when looking at the error log. Not to mention any other error handling will be running under an unexpected context from the original context