[ANN] V4RB 2.0b2

jda jda at his.com
Tue May 18 17:11:05 CDT 2004


>>
>>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
>

Good point, Charles. I haven't used the (relatively) new try/catch 
feature, but it would work well here. Thanks.

Jon


More information about the Valentina-beta mailing list