declex
declex copied to clipboard
Action processing error when returning bools
When this method is processed:
protected Boolean validateTutorOperation() {
User_ currentUser = authenticateManager.getCurrentUser();
if (currentUser == null) {
{$TutorDataError("Only a logged in user can create lessons");}
return false;
} else if (!currentUser.isTeacher()) {
{$TutorDataError("Only a tutors can create lessons");}
return false;
}
return true;
}
The actions processers generates multiple errors due to the returns.
To bypass the error for now, I had to call the action in another method, like this:
protected Boolean validateTutorOperation() {
User_ currentUser = authenticateManager.getCurrentUser();
if (currentUser == null) {
sendError("Only a logged in user can create lessons");
return false;
} else if (!currentUser.isTeacher()) {
sendError("Only a tutors can create lessons");
return false;
}
return true;
}
protected void sendError(String errorMessage) {
$TutorDataError(errorMessage);
}