Yes, try returning it first. If less than 30 days, AND you didn't drop this camera, your store should accept it for exchange or refund.
But in the case that your store gives you a hassle and directs you to the vendor under warranty, AND the vendor refuses to repair the camera saying it has dirt accumulation or was dropped, see the following:
Unfortunately, many cameras that fall prey to lens error problems can only be corrected by professional repair. But, here are some last resort troubleshooting steps
that you can try that may correct it. They only seem to work for less than 40% of the lens errors, but if the camera is out of warranty (or repair cost approaches that of the camera), they're worth that try.