Just look for a special error string in the document text that you populate when there's an error on the back-end. It's not a great solution, but it does work, especially if you can control the response content that is populated into the TBrowser instance.