You can capture it like this:
error=$(memtester 900 1 2>&1 >/dev/null)
order of redirection operators is important here.
2>&1
>/dev/null
/dev/null