throw a more helpful error if null/undefined data is passed to attachData