adding a check to throw an error if localStorage is too large