corrected references to class attribute

changed $error to $this->error