Only uses JError if JError::$legacy is on

Stops Joomla 3.0 users using deprecated function JError