Use of "Set $ECODE"
- Exception handling
Setting the $ECODE special variable is especially confusing and, moreover, dangerous:
- it will throw an exception if and only if the value is not an empty string;
- since this is the SET command, in addition to this, there may also be a postconditional.
As a result, when reading this line:
set:someCondition $ecode = somevalue
it is impossible to tell whether the code will actually throw an exception, apart from having studied all the body of the method prior to this statement (to figure out the value of both the someCondition and somevalue variables).
Using THROW has none of these problems.