Browse Source

* Add RangeIndexError (delphi compatible)

Michaël Van Canneyt 11 months ago
parent
commit
0533acdc27
2 changed files with 7 additions and 0 deletions
  1. 1 0
      rtl/objpas/sysutils/sysutilh.inc
  2. 6 0
      rtl/objpas/sysutils/sysutils.inc

+ 1 - 0
rtl/objpas/sysutils/sysutilh.inc

@@ -264,6 +264,7 @@ type
    procedure ListIndexError(aIndex,aMax: Integer; aObj: TObject);
    procedure ListIndexError(aIndex,aMax: Integer; aObj: TObject);
    function ListIndexErrorMsg(aIndex, aMaxIndex: SizeInt; const aListObjName: string): string; overload;
    function ListIndexErrorMsg(aIndex, aMaxIndex: SizeInt; const aListObjName: string): string; overload;
    function ListIndexErrorMsg(aIndex, aMaxIndex: SizeInt; aListObj: TObject): string; overload;
    function ListIndexErrorMsg(aIndex, aMaxIndex: SizeInt; aListObj: TObject): string; overload;
+   procedure RangeIndexError(aIndex, aMaxIndex: SizeInt; aListObj: TObject);
     
     
 Type
 Type
    TBeepHandler = Procedure;
    TBeepHandler = Procedure;

+ 6 - 0
rtl/objpas/sysutils/sysutils.inc

@@ -531,6 +531,12 @@ end;
 
 
 {$pop} //{$S-} for Error handling functions
 {$pop} //{$S-} for Error handling functions
 
 
+procedure RangeIndexError(aIndex, aMaxIndex: SizeInt; aListObj: TObject);
+
+begin
+  raise ERangeError.Create(ListIndexErrorMsg(aIndex,aMaxIndex,aListObj));
+end;
+
 Procedure InitExceptions;
 Procedure InitExceptions;
 {
 {
   Must install uncaught exception handler (ExceptProc)
   Must install uncaught exception handler (ExceptProc)