mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 00:59:47 +02:00
codetools: linkscanner: unique ids for errors
git-svn-id: branches/fixes_1_8@54683 -
This commit is contained in:
parent
bf7a622801
commit
52199c87c7
@ -1791,16 +1791,15 @@ begin
|
|||||||
fErrorMsg:=AnException.Message;
|
fErrorMsg:=AnException.Message;
|
||||||
if (AnException is ELinkScannerError) then begin
|
if (AnException is ELinkScannerError) then begin
|
||||||
// link scanner error
|
// link scanner error
|
||||||
|
FErrorId:=ELinkScannerError(AnException).Id;
|
||||||
if AnException is ELinkScannerConsistency then
|
if AnException is ELinkScannerConsistency then
|
||||||
DumpExceptionBackTrace;
|
DumpExceptionBackTrace;
|
||||||
DirtyPos:=0;
|
DirtyPos:=0;
|
||||||
if AnException is ELinkScannerEditError then begin
|
if AnException is ELinkScannerEditError then begin
|
||||||
FErrorId:=20170421202931;
|
|
||||||
fErrorCode:=TCodeBuffer(ELinkScannerEditError(AnException).Buffer);
|
fErrorCode:=TCodeBuffer(ELinkScannerEditError(AnException).Buffer);
|
||||||
if fErrorCode<>nil then
|
if fErrorCode<>nil then
|
||||||
DirtyPos:=ELinkScannerEditError(AnException).BufferPos;
|
DirtyPos:=ELinkScannerEditError(AnException).BufferPos;
|
||||||
end else begin
|
end else begin
|
||||||
FErrorId:=20170421202945;
|
|
||||||
fErrorCode:=TCodeBuffer(ELinkScannerError(AnException).Sender.Code);
|
fErrorCode:=TCodeBuffer(ELinkScannerError(AnException).Sender.Code);
|
||||||
DirtyPos:=ELinkScannerError(AnException).Sender.SrcPos;
|
DirtyPos:=ELinkScannerError(AnException).Sender.SrcPos;
|
||||||
end;
|
end;
|
||||||
|
@ -398,9 +398,13 @@ type
|
|||||||
);
|
);
|
||||||
|
|
||||||
{ Error handling }
|
{ Error handling }
|
||||||
|
|
||||||
|
{ ELinkScannerError }
|
||||||
|
|
||||||
ELinkScannerError = class(Exception)
|
ELinkScannerError = class(Exception)
|
||||||
Sender: TLinkScanner;
|
Sender: TLinkScanner;
|
||||||
constructor Create(ASender: TLinkScanner; const AMessage: string);
|
Id: int64;
|
||||||
|
constructor Create(ASender: TLinkScanner; TheId: int64; const AMessage: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ELinkScannerErrors = class of ELinkScannerError;
|
ELinkScannerErrors = class of ELinkScannerError;
|
||||||
@ -410,10 +414,12 @@ type
|
|||||||
ELinkScannerAbort = class(ELinkScannerError);
|
ELinkScannerAbort = class(ELinkScannerError);
|
||||||
ELinkScannerConsistency = class(ELinkScannerError);
|
ELinkScannerConsistency = class(ELinkScannerError);
|
||||||
|
|
||||||
|
{ ELinkScannerEditError }
|
||||||
|
|
||||||
ELinkScannerEditError = class(ELinkScannerError)
|
ELinkScannerEditError = class(ELinkScannerError)
|
||||||
Buffer: Pointer;
|
Buffer: Pointer;
|
||||||
BufferPos: integer;
|
BufferPos: integer;
|
||||||
constructor Create(ASender: TLinkScanner; const AMessage: string;
|
constructor Create(ASender: TLinkScanner; TheId: int64; const AMessage: string;
|
||||||
ABuffer: Pointer; ABufferPos: integer);
|
ABuffer: Pointer; ABufferPos: integer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -492,7 +498,7 @@ type
|
|||||||
procedure ReadCurlyComment;
|
procedure ReadCurlyComment;
|
||||||
procedure ReadLineComment;
|
procedure ReadLineComment;
|
||||||
procedure ReadRoundComment;
|
procedure ReadRoundComment;
|
||||||
procedure CommentEndNotFound;
|
procedure CommentEndNotFound(id: int64);
|
||||||
procedure EndComment; inline;
|
procedure EndComment; inline;
|
||||||
procedure IncCommentLevel; inline;
|
procedure IncCommentLevel; inline;
|
||||||
procedure DecCommentLevel; inline;
|
procedure DecCommentLevel; inline;
|
||||||
@ -589,14 +595,15 @@ type
|
|||||||
LastErrorIsValid: boolean;
|
LastErrorIsValid: boolean;
|
||||||
LastErrorBehindIgnorePosition: boolean;
|
LastErrorBehindIgnorePosition: boolean;
|
||||||
LastErrorCheckedForIgnored: boolean;
|
LastErrorCheckedForIgnored: boolean;
|
||||||
|
LastErrorId: int64;
|
||||||
CleanedIgnoreErrorAfterPosition: integer;// ignore if valid and >=
|
CleanedIgnoreErrorAfterPosition: integer;// ignore if valid and >=
|
||||||
procedure RaiseExceptionFmt(const AMessage: string; Args: array of const);
|
procedure RaiseExceptionFmt(id: int64; const AMessage: string; const Args: array of const);
|
||||||
procedure RaiseException(const AMessage: string);
|
procedure RaiseException(id: int64; const AMessage: string);
|
||||||
procedure RaiseExceptionClass(const AMessage: string;
|
procedure RaiseExceptionClass(id: int64; const AMessage: string;
|
||||||
ExceptionClass: ELinkScannerErrors);
|
ExceptionClass: ELinkScannerErrors);
|
||||||
procedure RaiseEditException(const AMessage: string; ABuffer: Pointer;
|
procedure RaiseEditException(id: int64; const AMessage: string; ABuffer: Pointer;
|
||||||
ABufferPos: integer);
|
ABufferPos: integer);
|
||||||
procedure RaiseConsistencyException(const AMessage: string);
|
procedure RaiseConsistencyException(id: int64; const AMessage: string);
|
||||||
procedure ClearLastError;
|
procedure ClearLastError;
|
||||||
procedure RaiseLastError;
|
procedure RaiseLastError;
|
||||||
procedure DoCheckAbort;
|
procedure DoCheckAbort;
|
||||||
@ -1445,7 +1452,7 @@ function TLinkScanner.LinkSize(Index: integer): integer;
|
|||||||
|
|
||||||
procedure IndexOutOfBounds;
|
procedure IndexOutOfBounds;
|
||||||
begin
|
begin
|
||||||
RaiseConsistencyException('TLinkScanner.LinkSize index '
|
RaiseConsistencyException(20170422125948,'TLinkScanner.LinkSize index '
|
||||||
+IntToStr(Index)+' out of bounds: 0..'+IntToStr(LinkCount-1));
|
+IntToStr(Index)+' out of bounds: 0..'+IntToStr(LinkCount-1));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1698,7 +1705,7 @@ procedure TLinkScanner.SetSource(ACode: Pointer);
|
|||||||
|
|
||||||
procedure RaiseUnableToGetCode;
|
procedure RaiseUnableToGetCode;
|
||||||
begin
|
begin
|
||||||
RaiseConsistencyException('unable to get source with Code='+DbgS(Code));
|
RaiseConsistencyException(20170422125957,'unable to get source with Code='+DbgS(Code));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var SrcLog: TSourceLog;
|
var SrcLog: TSourceLog;
|
||||||
@ -2188,7 +2195,7 @@ begin
|
|||||||
SrcPos:=p-PChar(Src)+1;
|
SrcPos:=p-PChar(Src)+1;
|
||||||
CommentEndPos:=SrcPos;
|
CommentEndPos:=SrcPos;
|
||||||
CommentInnerEndPos:=SrcPos-1;
|
CommentInnerEndPos:=SrcPos-1;
|
||||||
if (CommentLevel>0) then CommentEndNotFound;
|
if (CommentLevel>0) then CommentEndNotFound(20170422130048);
|
||||||
// handle compiler switches
|
// handle compiler switches
|
||||||
if Src[CommentInnerStartPos]='$' then
|
if Src[CommentInnerStartPos]='$' then
|
||||||
HandleDirective;
|
HandleDirective;
|
||||||
@ -2259,17 +2266,17 @@ begin
|
|||||||
SrcPos:=p-PChar(Src)+1;
|
SrcPos:=p-PChar(Src)+1;
|
||||||
CommentEndPos:=SrcPos;
|
CommentEndPos:=SrcPos;
|
||||||
CommentInnerEndPos:=SrcPos-2;
|
CommentInnerEndPos:=SrcPos-2;
|
||||||
if (CommentLevel>0) then CommentEndNotFound;
|
if (CommentLevel>0) then CommentEndNotFound(20170422130050);
|
||||||
// handle compiler switches
|
// handle compiler switches
|
||||||
if Src[CommentInnerStartPos]='$' then
|
if Src[CommentInnerStartPos]='$' then
|
||||||
HandleDirective;
|
HandleDirective;
|
||||||
EndComment;
|
EndComment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.CommentEndNotFound;
|
procedure TLinkScanner.CommentEndNotFound(id: int64);
|
||||||
begin
|
begin
|
||||||
SrcPos:=CommentStartPos;
|
SrcPos:=CommentStartPos;
|
||||||
RaiseException(ctsCommentEndNotFound);
|
RaiseException(id,ctsCommentEndNotFound);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.UpdateCleanedSource(NewCopiedSrcPos: integer);
|
procedure TLinkScanner.UpdateCleanedSource(NewCopiedSrcPos: integer);
|
||||||
@ -2278,7 +2285,7 @@ procedure TLinkScanner.UpdateCleanedSource(NewCopiedSrcPos: integer);
|
|||||||
procedure RaiseInvalid;
|
procedure RaiseInvalid;
|
||||||
begin
|
begin
|
||||||
debugln(['TLinkScanner.UpdateCleanedSource inconsistency found: Srclen=',SrcLen,'=',length(Src),' FCleanedSrc=',CleanedLen,'/',length(FCleanedSrc),' CopiedSrcPos=',CopiedSrcPos,' NewCopiedSrcPos=',NewCopiedSrcPos,' AddLen=',NewCopiedSrcPos-CopiedSrcPos]);
|
debugln(['TLinkScanner.UpdateCleanedSource inconsistency found: Srclen=',SrcLen,'=',length(Src),' FCleanedSrc=',CleanedLen,'/',length(FCleanedSrc),' CopiedSrcPos=',CopiedSrcPos,' NewCopiedSrcPos=',NewCopiedSrcPos,' AddLen=',NewCopiedSrcPos-CopiedSrcPos]);
|
||||||
RaiseConsistencyException('TLinkScanner.UpdateCleanedSource inconsistency found AddLen='+dbgs(NewCopiedSrcPos-CopiedSrcPos));
|
RaiseConsistencyException(20170422130054,'TLinkScanner.UpdateCleanedSource inconsistency found AddLen='+dbgs(NewCopiedSrcPos-CopiedSrcPos));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var AddLen: integer;
|
var AddLen: integer;
|
||||||
@ -2306,7 +2313,7 @@ procedure TLinkScanner.AddSourceChangeStep(ACode: pointer; AChangeStep: integer)
|
|||||||
|
|
||||||
procedure RaiseCodeNil;
|
procedure RaiseCodeNil;
|
||||||
begin
|
begin
|
||||||
RaiseConsistencyException('TLinkScanner.AddSourceChangeStep ACode=nil');
|
RaiseConsistencyException(20170422130109,'TLinkScanner.AddSourceChangeStep ACode=nil');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var l,r,m: integer;
|
var l,r,m: integer;
|
||||||
@ -3363,7 +3370,7 @@ begin
|
|||||||
else if (FDirectiveName='ALIGN') then
|
else if (FDirectiveName='ALIGN') then
|
||||||
// set record align size
|
// set record align size
|
||||||
else begin
|
else begin
|
||||||
RaiseExceptionFmt(ctsInvalidFlagValueForDirective,
|
RaiseExceptionFmt(20170422130112,ctsInvalidFlagValueForDirective,
|
||||||
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
||||||
end;
|
end;
|
||||||
Result:=ReadNextSwitchDirective;
|
Result:=ReadNextSwitchDirective;
|
||||||
@ -3384,7 +3391,7 @@ begin
|
|||||||
else if CompareUpToken('OFF',Src,ValStart,SrcPos) then
|
else if CompareUpToken('OFF',Src,ValStart,SrcPos) then
|
||||||
SetDirectiveValueWithSequence(ADirective, '0')
|
SetDirectiveValueWithSequence(ADirective, '0')
|
||||||
else begin
|
else begin
|
||||||
RaiseExceptionFmt(ctsInvalidFlagValueForDirective,
|
RaiseExceptionFmt(20170422130115,ctsInvalidFlagValueForDirective,
|
||||||
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
||||||
end;
|
end;
|
||||||
Result:=ReadNextSwitchDirective;
|
Result:=ReadNextSwitchDirective;
|
||||||
@ -3405,7 +3412,7 @@ begin
|
|||||||
else if CompareUpToken('OFF',Src,ValStart,SrcPos) then
|
else if CompareUpToken('OFF',Src,ValStart,SrcPos) then
|
||||||
FMacrosOn:=false
|
FMacrosOn:=false
|
||||||
else
|
else
|
||||||
RaiseExceptionFmt(ctsInvalidFlagValueForDirective,
|
RaiseExceptionFmt(20170422130118,ctsInvalidFlagValueForDirective,
|
||||||
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
[copy(Src,ValStart,SrcPos-ValStart),FDirectiveName]);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
@ -3443,7 +3450,7 @@ begin
|
|||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
if not ModeValid then
|
if not ModeValid then
|
||||||
RaiseExceptionFmt(ctsInvalidMode,[copy(Src,ValStart,SrcPos-ValStart)]);
|
RaiseExceptionFmt(20170422130122,ctsInvalidMode,[copy(Src,ValStart,SrcPos-ValStart)]);
|
||||||
end;
|
end;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
@ -3485,7 +3492,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
RaiseExceptionFmt(ctsInvalidModeSwitch,[copy(Src,ValStart,SrcPos-ValStart)]);
|
RaiseExceptionFmt(20170422130125,ctsInvalidModeSwitch,[copy(Src,ValStart,SrcPos-ValStart)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.ThreadingDirective: boolean;
|
function TLinkScanner.ThreadingDirective: boolean;
|
||||||
@ -3598,7 +3605,7 @@ function TLinkScanner.EndifDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ENDIF','$IF'])
|
RaiseExceptionFmt(20170422130128,ctsAwithoutB,['$ENDIF','$IF'])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3624,7 +3631,7 @@ function TLinkScanner.EndCDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ENDC','$IFC'])
|
RaiseExceptionFmt(20170422130131,ctsAwithoutB,['$ENDC','$IFC'])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3648,7 +3655,7 @@ function TLinkScanner.IfEndDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$IfEnd','$ElseIf'])
|
RaiseExceptionFmt(20170422130134,ctsAwithoutB,['$IfEnd','$ElseIf'])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3671,7 +3678,7 @@ function TLinkScanner.ElseDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ELSE','$IF']);
|
RaiseExceptionFmt(20170422130138,ctsAwithoutB,['$ELSE','$IF']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3699,7 +3706,7 @@ function TLinkScanner.ElseCDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ELSEC','$IFC']);
|
RaiseExceptionFmt(20170422130140,ctsAwithoutB,['$ELSEC','$IFC']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3728,7 +3735,7 @@ function TLinkScanner.ElseIfDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ELSEIF','$IF']);
|
RaiseExceptionFmt(20170422130143,ctsAwithoutB,['$ELSEIF','$IF']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3752,7 +3759,7 @@ function TLinkScanner.ElIfCDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseAWithoutB;
|
procedure RaiseAWithoutB;
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(ctsAwithoutB,['$ELIFC','$IFC']);
|
RaiseExceptionFmt(20170422130146,ctsAwithoutB,['$ELIFC','$IFC']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -3879,7 +3886,7 @@ begin
|
|||||||
IncFilename:=copy(IncFilename,2,length(IncFilename)-2)
|
IncFilename:=copy(IncFilename,2,length(IncFilename)-2)
|
||||||
else begin
|
else begin
|
||||||
SrcPos:=CommentInnerEndPos;
|
SrcPos:=CommentInnerEndPos;
|
||||||
RaiseException('missing ''');
|
RaiseException(20170422130149,'missing ''');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ForcePathDelims(IncFilename);
|
ForcePathDelims(IncFilename);
|
||||||
@ -4105,7 +4112,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (not IgnoreMissingIncludeFiles) then begin
|
if (not IgnoreMissingIncludeFiles) then begin
|
||||||
// ToDo: add an event to let application improve the error message
|
// ToDo: add an event to let application improve the error message
|
||||||
RaiseExceptionFmt(ctsIncludeFileNotFound,[AFilename])
|
RaiseExceptionFmt(20170422130152,ctsIncludeFileNotFound,[AFilename])
|
||||||
end else begin
|
end else begin
|
||||||
// add a dummy link
|
// add a dummy link
|
||||||
AddLink(SrcPos,nil,slkMissingIncludeFile);
|
AddLink(SrcPos,nil,slkMissingIncludeFile);
|
||||||
@ -4164,7 +4171,7 @@ procedure TLinkScanner.PushIncludeLink(ACleanedPos, ASrcPos: integer;
|
|||||||
|
|
||||||
procedure RaiseIncludeCircleDetected;
|
procedure RaiseIncludeCircleDetected;
|
||||||
begin
|
begin
|
||||||
RaiseException(ctsIncludeCircleDetected);
|
RaiseException(20170422130154,ctsIncludeCircleDetected);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var NewLink: PSourceLink;
|
var NewLink: PSourceLink;
|
||||||
@ -4561,7 +4568,7 @@ function TLinkScanner.InternalIfDirective: boolean;
|
|||||||
|
|
||||||
procedure RaiseMissingExpr;
|
procedure RaiseMissingExpr;
|
||||||
begin
|
begin
|
||||||
RaiseException('missing expression');
|
RaiseException(20170422130156,'missing expression');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -4576,7 +4583,7 @@ begin
|
|||||||
//DebugLn(['TLinkScanner.InternalIfDirective ExprResult=',ExprResult]);
|
//DebugLn(['TLinkScanner.InternalIfDirective ExprResult=',ExprResult]);
|
||||||
if Values.ErrorPosition>=0 then begin
|
if Values.ErrorPosition>=0 then begin
|
||||||
inc(SrcPos,Values.ErrorPosition);
|
inc(SrcPos,Values.ErrorPosition);
|
||||||
RaiseException(Values.ErrorMsg)
|
RaiseException(20170422130200,Values.ErrorMsg)
|
||||||
end else if ExprResult then begin
|
end else if ExprResult then begin
|
||||||
// expression evaluates to true => stop skipping and parse block
|
// expression evaluates to true => stop skipping and parse block
|
||||||
if FDirectivesCount>0 then
|
if FDirectivesCount>0 then
|
||||||
@ -4780,7 +4787,7 @@ function TLinkScanner.WholeRangeIsWritable(CleanStartPos, CleanEndPos: integer;
|
|||||||
procedure EditError(const AMessage: string; ACode: Pointer);
|
procedure EditError(const AMessage: string; ACode: Pointer);
|
||||||
begin
|
begin
|
||||||
if ErrorOnFail then
|
if ErrorOnFail then
|
||||||
RaiseEditException(AMessage,ACode,0);
|
RaiseEditException(20170422130202,AMessage,ACode,0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -4901,37 +4908,39 @@ begin
|
|||||||
if Assigned(OnSetGlobalWriteLock) then OnSetGlobalWriteLock(false);
|
if Assigned(OnSetGlobalWriteLock) then OnSetGlobalWriteLock(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.RaiseExceptionFmt(const AMessage: string;
|
procedure TLinkScanner.RaiseExceptionFmt(id: int64; const AMessage: string;
|
||||||
Args: array of const);
|
const Args: array of const);
|
||||||
begin
|
begin
|
||||||
RaiseException(Format(AMessage,args));
|
RaiseException(id,Format(AMessage,args));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.RaiseException(const AMessage: string);
|
procedure TLinkScanner.RaiseException(id: int64; const AMessage: string);
|
||||||
begin
|
begin
|
||||||
RaiseExceptionClass(AMessage,ELinkScannerError);
|
RaiseExceptionClass(id,AMessage,ELinkScannerError);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.RaiseExceptionClass(const AMessage: string;
|
procedure TLinkScanner.RaiseExceptionClass(id: int64; const AMessage: string;
|
||||||
ExceptionClass: ELinkScannerErrors);
|
ExceptionClass: ELinkScannerErrors);
|
||||||
begin
|
begin
|
||||||
LastErrorMessage:=AMessage;
|
LastErrorMessage:=AMessage;
|
||||||
LastErrorSrcPos:=SrcPos;
|
LastErrorSrcPos:=SrcPos;
|
||||||
LastErrorCode:=Code;
|
LastErrorCode:=Code;
|
||||||
LastErrorCheckedForIgnored:=false;
|
LastErrorCheckedForIgnored:=false;
|
||||||
|
LastErrorId:=id;
|
||||||
LastErrorIsValid:=true;
|
LastErrorIsValid:=true;
|
||||||
raise ExceptionClass.Create(Self,AMessage);
|
raise ExceptionClass.Create(Self,id,AMessage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.RaiseEditException(const AMessage: string;
|
procedure TLinkScanner.RaiseEditException(id: int64; const AMessage: string;
|
||||||
ABuffer: Pointer; ABufferPos: integer);
|
ABuffer: Pointer; ABufferPos: integer);
|
||||||
begin
|
begin
|
||||||
raise ELinkScannerEditError.Create(Self,AMessage,ABuffer,ABufferPos);
|
raise ELinkScannerEditError.Create(Self,id,AMessage,ABuffer,ABufferPos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.RaiseConsistencyException(const AMessage: string);
|
procedure TLinkScanner.RaiseConsistencyException(id: int64;
|
||||||
|
const AMessage: string);
|
||||||
begin
|
begin
|
||||||
RaiseExceptionClass(AMessage,ELinkScannerConsistency);
|
RaiseExceptionClass(id,AMessage,ELinkScannerConsistency);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.ClearLastError;
|
procedure TLinkScanner.ClearLastError;
|
||||||
@ -4944,7 +4953,7 @@ procedure TLinkScanner.RaiseLastError;
|
|||||||
begin
|
begin
|
||||||
SrcPos:=LastErrorSrcPos;
|
SrcPos:=LastErrorSrcPos;
|
||||||
Code:=LastErrorCode;
|
Code:=LastErrorCode;
|
||||||
RaiseException(LastErrorMessage);
|
RaiseException(20170422130205,LastErrorMessage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.DoCheckAbort;
|
procedure TLinkScanner.DoCheckAbort;
|
||||||
@ -4952,7 +4961,7 @@ begin
|
|||||||
if not Assigned(OnProgress) then exit;
|
if not Assigned(OnProgress) then exit;
|
||||||
if OnProgress(Self) then exit;
|
if OnProgress(Self) then exit;
|
||||||
// raise abort exception
|
// raise abort exception
|
||||||
RaiseExceptionClass('Abort',ELinkScannerAbort);
|
RaiseExceptionClass(20170422130207,'Abort',ELinkScannerAbort);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.MainFilename: string;
|
function TLinkScanner.MainFilename: string;
|
||||||
@ -4965,11 +4974,12 @@ end;
|
|||||||
|
|
||||||
{ ELinkScannerError }
|
{ ELinkScannerError }
|
||||||
|
|
||||||
constructor ELinkScannerError.Create(ASender: TLinkScanner;
|
constructor ELinkScannerError.Create(ASender: TLinkScanner; TheId: int64;
|
||||||
const AMessage: string);
|
const AMessage: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(AMessage);
|
inherited Create(AMessage);
|
||||||
Sender:=ASender;
|
Sender:=ASender;
|
||||||
|
id:=TheId;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPSourceLinkMemManager }
|
{ TPSourceLinkMemManager }
|
||||||
@ -5141,10 +5151,10 @@ end;
|
|||||||
|
|
||||||
{ ELinkScannerEditError }
|
{ ELinkScannerEditError }
|
||||||
|
|
||||||
constructor ELinkScannerEditError.Create(ASender: TLinkScanner;
|
constructor ELinkScannerEditError.Create(ASender: TLinkScanner; TheId: int64;
|
||||||
const AMessage: string; ABuffer: Pointer; ABufferPos: integer);
|
const AMessage: string; ABuffer: Pointer; ABufferPos: integer);
|
||||||
begin
|
begin
|
||||||
inherited Create(ASender,AMessage);
|
inherited Create(ASender,TheId,AMessage);
|
||||||
Buffer:=ABuffer;
|
Buffer:=ABuffer;
|
||||||
BufferPos:=ABufferPos;
|
BufferPos:=ABufferPos;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user