[V4REV] Discussion of Error Notification.

Robert Brenstein rjb at robelko.com
Sun Jun 12 16:55:31 CDT 2005


At 08:41 +0300 12.06.2005, Ruslan Zasukhin wrote:
>On 6/12/05 2:17 AM, "Robert Brenstein" <rjb at robelko.com> wrote:
>
>>  I think the current method of returning error is fine (your #2). At
>>  least it is consistent with the way other call return errors. Or are
>>  you planning to handle errors differently in V2?
>
>For now we have made it as "Error nnn"
>
>But we wonder if exists any better way for Revolution ?
>
>Revolution do not have exceptions, right?
>
>And it is better return "Error nnn" to avoid extra call
>         Database_LastError
>
>Right ?
>

Revolution has exceptions and we can trigger them in Transcript. Look 
at the "try" structure and the "throw" command. However, I'd 
personally rather keep exceptions for trapping runtime execution 
errors and special situations.

I find it easy enough and convenient to handle getting "error xxx" in 
the result, although in principle, either this way or 
"Database_LastError" are fine as long as it is consistent. On the 
other hand, the small but nevertheless overhead of the extra function 
call to "Database_LastError" may add up when running loops through 
thousands of records, particularly as it may be called multiple times 
in a single loop.

The only thing that I find somewhat annoying in this area with 
Valentina 1.x is that while most functions return "error", some 
functions return false in case of failure and some return 0. Because 
of that I need always 3 different assertion handlers and make sure to 
use the right one after any Valentina call.

Robert


More information about the Valentina mailing list