Recent

Author Topic: Raising exceptions using CreateResFmt  (Read 4932 times)

RodneyK

  • New Member
  • *
  • Posts: 16
Raising exceptions using CreateResFmt
« on: December 29, 2010, 12:43:59 am »
I have the following code in a unit.

  if (Index > Length(S)) or (Index < 1) then
    raise EArgumentOutOfRangeException.CreateResFmt(@sArgumentOutOfRange_StringIndex, [Index, Length(S)]);

This is causing compiler error 'Error: Identifier not found EArgumentOutOfRangeException'

The code seems valid to me but maybe somebody can help me understand this.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Raising exceptions using CreateResFmt
« Reply #1 on: December 29, 2010, 02:14:29 pm »
You could try a feature request on BugTracker.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Raising exceptions using CreateResFmt
« Reply #2 on: December 29, 2010, 03:47:17 pm »
We don't have EArgumentOutOfRangeException in SysUtils yet. Are you coming from newer Delphi versions? You could try what typo suggests (though IMO a simple EArgumentOutOfRangeException = class(Exception) would be enough).

RodneyK

  • New Member
  • *
  • Posts: 16
Re: Raising exceptions using CreateResFmt
« Reply #3 on: December 29, 2010, 06:58:24 pm »
No wonder I couldn't find it. I'll just add the declaration to my projects common files. I'll also add a bug request.
Thanks guys.

 

TinyPortal © 2005-2018