I have set the compile option requireReturnValues="Error"
.
I tried to compile the following example code but it doesn't pass the option:
METHOD PUBLIC LOGICAL checkValue(i_cValue AS CHAR):
IF i_cValue <> ? THEN DO:
RETURN TRUE.
END.
UNDO, THROW NEW Progress.Lang.AppError("Invalid value!").
END METHOD.
If I rearrange the code, by moving RETURN TRUE.
into the end, it works as intended.
Is there any other way to make it work?
METHOD PUBLIC LOGICAL checkValue(i_cValue AS CHAR):
IF i_cValue = ? THEN DO:
UNDO, THROW NEW Progress.Lang.AppError("Invalid value!").
END.
RETURN TRUE.
END METHOD.
It seems that for now the only way is to refactor the code to throw errors before returning a value in the end.