ascot diagnostics

A3236

Warning: $CASE without a default raises <ILLEGAL VALUE> when no case matches

The $CASE has no :default, and its target can hold a value that no case lists. IRIS compiles it and raises <ILLEGAL VALUE> when it runs with such a value. Add a :default as the last pair, unless the $CASE is meant to fail outside the listed values.

IRIS compiles the example, and write ##class(Demo.CaseWithoutDefault).Name(4) raises <ILLEGAL VALUE> when it runs.

Class Demo.CaseWithoutDefault
{

ClassMethod Name(size As %Integer) As %String
{
    Quit $CASE(size, 1:"small", 2:"medium", 3:"large") //! A3236
}

}

All diagnostics