Kbase 21576: Why ERROR-STATUS:ERROR Is Not Always Set By ASSIGN NO-ERROR
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
SUMMARY:
Sometimes it appears that the ERROR attribute of the ERROR-STATUS System Handle is not set as it should be when using the NO-ERROR option in an ASSIGN statement, whereas messages are appended to the GET-MESSAGE() stack.
This problem has been especially apparent when assigning widget or object attributes. For instance, with a List-Item-Pairs Combo-Box called CB, if you do:
CB:LIST-ITEM-PAIRS = "Only one item!" NO-ERROR.
the ERROR-STATUS:ERROR will remain set to false and you will not receive error messages 7452 and 4058. They are, however, available with ERROR-STATUS:GET-MESSAGE(1 and 2).
EXPLANATION:
The ERROR-STATUS:ERROR is not set whenever an error message is generated. Rather, it is set only when the error-condition is raised. The error-condition is raised only for more serious errors; many of which involve database errors (or UNDO variables). When an error-condition is raised, and there is no NO-ERROR on the statement, that is when all the block-level Undo and Retry processing happens.
The syntax error shown with List-Item-Pairs above is not the sort of error that an error-condition would be raised for.
SOLUTION:
There are a couple of possible ways to deal with this. If you really need to know whether an error occurred or not, you can try these methods:
-- If the application has the message area showing, add this line of
code -- SESSION:SYSTEM-ALERT-BOXES = NO. Then remove the NO-ERROR
from the statement. Now, when the statement executes, the errors
will appear in the message area. Or, if Alert-Boxes are
acceptable, then just remove the NO-ERROR syntax.
-- The best option might be to use methods to manage the widgets or
objects. These all return a logical value showing whether they
were successful or not. Just query the logical variable and
proceed accordingly.
Example -- if you have a logical variable called MthRtn and this
syntax:
MthRtn = DecimalComboBox:ADD-LAST("One item makes problem")
NO-ERROR.
then MthRtn will be set to NO as desired, and ERROR-STATUS:ERROR
will still be set to NO.