Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well,</p> <p>It is gonna be hard without your source code, but i have tested this: </p> <p><a href="http://edn.embarcadero.com/article/10452" rel="nofollow">How to handle exceptions in TThread objects</a></p> <p>And it works fine. Perhaps you should take a look at it. </p> <p>EDIT:</p> <p>You are not following what the links you point out tell us to do. Check my link and you will see how to do that.</p> <p>EDIT 2:</p> <p>Try that and tell me if it worked:</p> <pre><code> TUpdaterThread= class(TThread) private FException: Exception; procedure DoHandleException; protected procedure Execute; override; procedure HandleException; virtual; end; procedure TUpdaterThread.Execute; begin inherited; FreeOnTerminate := True; if Terminated then Exit; FileGrabber := THtmlExtractor.Create; HTTP := TIdHTTP.Create(Nil); try Try FileGrabber.Grab('http://jeffijoe.com/xSky/Updates/CheckForUpdates.php'); Except HandleException; End; Try AppMajor := StrToInt(FileGrabber.ExtractValue('AppMajor[', ']')); AppMinor := StrToInt(FileGrabber.ExtractValue('AppMinor[', ']')); AppRelease := StrToInt(FileGrabber.ExtractValue('AppRelease[[', ']')); Except HandleException; End; if (APP_VER_MAJOR &lt; AppMajor) or (APP_VER_MINOR &lt; AppMinor) or (APP_VER_RELEASE &lt; AppRelease) then begin VersionStr := Format('%d.%d.%d', [AppMajor, AppMinor, AppRelease]); UpdateText := 'Downloading Version ' + VersionStr; Synchronize(SyncUpdateLbl); end; finally FileGrabber.Free; HTTP.Free; end; Synchronize(SyncFinalize); end; procedure TUpdaterThread.HandleException; begin FException := Exception(ExceptObject); try Synchronize(DoHandleException); finally FException := nil; end; end; procedure TMyThread.DoHandleException; begin Application.ShowException(FException); end; </code></pre> <p>EDIT 3:</p> <p>You said you are no able to catch EIdHTTPProtocolException. But it works for me. Try this sample and see it for yourself:</p> <pre><code>procedure TUpdaterThread.Execute; begin Try raise EIdHTTPProtocolException.Create('test'); Except HandleException; End; end; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload