rename $error to $logError. seems more appropriate