Un'interessante risposta sul
Bugtracker di
Benoit alla richiesta di
Bruce:
This is just a shortcut to save having to include Print/Error commands just before the stop.
During development, I frequently leave unresolved error conditions hanging around with Stop's in them as I might be focussing on some other part of the code. These are usually the error conditions that don't happen often, such as I'm processing a large set of records with some complex code, maybe one record in the set has a null value that I haven't figured out what to do about yet as I'm looking at some other aspect of the processing....
So,
If not CurrentTransaction.Taxable Then Stop "Tax flag is null"
is a lot more concise than
If not CurrentTransaction.Taxable Then
Print "Tax flag is null"
Stop
Endif
(Especially in the middle of a complex set of if..elses)
and this is the important bit...
would immediately take my mind to the problem rather than having to think about what caused the Stop.
Also the reason for the stop might (and sometimes does) occur somewhere else.. so
If sFault then Stop sFault
where sFault is a message set nowhere near where the Stop command is in the code....
Benoit:
Why don't you use the
ASSERT instruction for that?
Assert CurrentTransaction.Taxable Print "Tax flag is null"
Semplice dimostrazione di utilizzo:
Public Sub Main()
Dim UnaStringaQualsiasi As String
Assert UnaStringaQualsiasi Print "#ERRORE la stringa risulta vuota"
End