IDE: outputfilter: only raising one exception

git-svn-id: trunk@24601 -
This commit is contained in:
mattias 2010-04-12 14:54:50 +00:00
parent 35197f4b0d
commit fe2c9e2b46

View File

@ -128,6 +128,7 @@ type
FScanLine: TOFScanLine; FScanLine: TOFScanLine;
FState: TOutputFilterState; FState: TOutputFilterState;
FHasReadErrorLine: Boolean; FHasReadErrorLine: Boolean;
FHasRaisedException: boolean;
FStopExecute: boolean; FStopExecute: boolean;
FLasTOutputLineParts: integer; FLasTOutputLineParts: integer;
fLastOutputTime: TDateTime; fLastOutputTime: TDateTime;
@ -185,6 +186,7 @@ type
procedure EndBufferingOutput; procedure EndBufferingOutput;
procedure BeginUpdate; procedure BeginUpdate;
procedure EndUpdate; procedure EndUpdate;
procedure RaiseOutputFilterError(const Msg: string);
public public
property CurrentDirectory: string read fCurrentDirectory property CurrentDirectory: string read fCurrentDirectory
write fCurrentDirectory; write fCurrentDirectory;
@ -442,7 +444,7 @@ begin
CleanUpExecute; CleanUpExecute;
end; end;
if ExceptionMsg<>'' then if ExceptionMsg<>'' then
raise EOutputFilterError.Create(ExceptionMsg); RaiseOutputFilterError(ExceptionMsg);
end; end;
function TOutputFilter.ExecuteAsyncron(TheProcess: TProcessUTF8; function TOutputFilter.ExecuteAsyncron(TheProcess: TProcessUTF8;
@ -452,6 +454,7 @@ begin
if FState = ofsRunning then RaiseGDBException('OutputFilter already running'); if FState = ofsRunning then RaiseGDBException('OutputFilter already running');
FState := ofsRunning; FState := ofsRunning;
FHasReadErrorLine := False; FHasReadErrorLine := False;
FHasRaisedException := False;
Clear; Clear;
fProcess:=TheProcess; fProcess:=TheProcess;
@ -785,7 +788,7 @@ var i, j, FilenameEndPos: integer;
end; end;
DoAddFilteredLine(NewLine); DoAddFilteredLine(NewLine);
if (ofoExceptionOnError in Options) then if (ofoExceptionOnError in Options) then
raise EOutputFilterError.Create(NewLine); RaiseOutputFilterError(NewLine);
Result:=true; Result:=true;
exit; exit;
end; end;
@ -1209,8 +1212,7 @@ begin
if (ofoExceptionOnError in Options) and (MsgType in [etPanic, etFatal]) if (ofoExceptionOnError in Options) and (MsgType in [etPanic, etFatal])
then then
raise EOutputFilterError.Create(Msg); RaiseOutputFilterError(Msg);
Result:=true; Result:=true;
exit; exit;
end; end;
@ -1565,7 +1567,7 @@ begin
DoAddFilteredLine(s); DoAddFilteredLine(s);
if CompareText(copy(MakeMsg,1,5),'Error')=0 then if CompareText(copy(MakeMsg,1,5),'Error')=0 then
if (ofoExceptionOnError in Options) then if (ofoExceptionOnError in Options) then
raise EOutputFilterError.Create(s); RaiseOutputFilterError(s);
exit; exit;
end; end;
end end
@ -1639,6 +1641,13 @@ begin
if Assigned(OnEndUpdate) then OnEndUpdate(Self); if Assigned(OnEndUpdate) then OnEndUpdate(Self);
end; end;
procedure TOutputFilter.RaiseOutputFilterError(const Msg: string);
begin
if FHasRaisedException then exit;
FHasRaisedException:=true;
raise EOutputFilterError.Create(Msg);
end;
{ TFilteredOutputLines } { TFilteredOutputLines }
function TFilteredOutputLines.GetOriginalIndices(Index: integer): integer; function TFilteredOutputLines.GetOriginalIndices(Index: integer): integer;