I'm writing a T/F problem that says "Every matrix A has a determinant." This is obviously false, and so in order to make the students have to do something more, I would like them enter a non-square matrix as an example. I have actually successfully made this possible in the Matrix context using:

ANS(Matrix([[0,2]])->cmp(

checker=>sub {

($correct,$student) = @_;

return 0 unless Value::classMatch($student, 'Matrix');

return !($student->isSquare);

}

));

However, if they enter a square matrix, it throws the message "Matrix dimension is not correct." I would like to make it say "The matrix you entered has a determinant" so I tried to add the line

$correct->context->setError("The matrix you entered has a determinant", $Value::CMP_WARNING) if $student->isSquare;

inside of the answer checker, but it didn't work. I also tried the usual Context()->{error}{msg}{""} = "" method, but that also didn't work. Could someone tell me where I'm going wrong?

Thanks a ton!

Rick