[ANN] V4RB 2.0b2

Charles Yeomans yeomans at desuetude.com
Tue May 18 17:09:02 CDT 2004


On May 18, 2004, at 4:12 PM, jda wrote:

>>
>>
>> I have one hope.
>> May be I will be able
>>
>> A) throw exceptions
>>
>> B) have flag: do not throw.
>>     developers that use EXISTED code, can set it OFF
>>     to not break code
>>
>> C) even if throw exc, db.LastError still will return last erro code.
>>
>
> There are other folks on this list with a better OOP background than 
> I, so I defer to them. But I like #3. There are times when a db.error 
> is expected and you don't want an exception thrown. For example, I 
> have a field for a unique ID. When I create a record, I assign a new 
> unique ID. I then check the db.error property to see if this caused a 
> "not unique" error. If so I loop through again, assigning a new unique 
> id, until I don't get the error any more. I think this would be more 
> cumbersome if the assignment of a non-unique ID threw an exception 
> (and took control away from my code loop).

It wouldn't if you use a try block, as in


While NOT IDCreated
   try
     CreateID
     IDCreated = true
   catch vExc as ValentinaException
      If vExc.ErrorCode <> 341 then
        Raise vExc //because it's an error other than uniqueness violated
      Else
         //
       End if
    end try
Wend


--------------
Charles Yeomans



More information about the Valentina-beta mailing list