Return error and exception if class is already declared (refs #4093)