* Merging revisions r46425 from trunk:

------------------------------------------------------------------------
    r46425 | michael | 2020-08-14 12:33:07 +0200 (Fri, 14 Aug 2020) | 1 line
    
    * Improved exception handling, patch by Henrique Werlang (bug ID 37567)
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@46621 -
This commit is contained in:
michael 2020-08-23 09:46:15 +00:00
parent 299421721a
commit b2c215203e
2 changed files with 11 additions and 14 deletions

View File

@ -123,15 +123,7 @@ end;
Function ExecuteStubCreator(P : PStubCreator) : Boolean; stdcall;
begin
Result:=False;
try
TStubCreator(P).Execute;
Result:=True;
except
On E: Exception do
Writeln('Exception ',E.ClassName,' ',E.Message);
// Ignore
end;
Result:=TStubCreator(P).Execute;
end;
Procedure GetStubCreatorLastError(P : PStubCreator; AError : PAnsiChar;

View File

@ -75,7 +75,7 @@ type
Public
Constructor Create(AOwner : TComponent); override;
Destructor Destroy; override;
Procedure Execute;
Function Execute: Boolean;
Procedure GetLastError(Out AError,AErrorClass : String);
// Streams take precedence over filenames. They will be freed on destroy!
// OutputStream can be used combined with write callbacks.
@ -202,19 +202,22 @@ begin
Include(O,woForwardClasses);
end;
procedure TStubCreator.Execute;
function TStubCreator.Execute: Boolean;
begin
FLastErrorClass:='';
FLastError:='';
Result := False;
if Defines.IndexOf('MakeStub')=-1 then
Try
DoExecute;
Result := True;
except
On E : Exception do
begin
FLastErrorClass:=E.Classname;
FLastError:=E.Message;
Raise;
end;
end;
end;
@ -307,6 +310,8 @@ begin
SCanner.OnLog:=SE.Onlog;
For S in FDefines do
Scanner.AddDefine(S);
if FDefines.IndexOf('MAKESTUB')=-1 then
Scanner.AddDefine('MAKESTUB');
Scanner.OpenFile(InputFilename);
// Parser
Parser:=TPasParser.Create(Scanner, FileResolver, SE);
@ -340,7 +345,7 @@ begin
FLineNumberWidth:=4;
FIndentSize:=2;
FExtraUnits:='';
FOptions:=[woNoImplementation,woNoExternalClass,woNoExternalVar,woNoExternalFunc,woNoAsm,woSkipPrivateExternals,woAlwaysRecordHelper];
FOptions:=[woNoImplementation,woNoExternalClass,woNoExternalVar,woNoExternalFunc,woNoAsm,woSkipPrivateExternals,woAlwaysRecordHelper,woSkipHints];
end;
destructor TStubCreator.Destroy;