Like other types of storage media, the flash cards used in digital cameras can run into problems. If you’re shooting and you encounter an error writing to your flash card, wait a few seconds to see if the problem goes away. If the images finish writing to the card but the problem persists:
1) remove the card and set it aside.
2) turn off the camera and remove and replace the camera battery.
3) restart the camera, insert a new card and format it before continuing to shoot.
If the images do not finish writing to the card, you may have lost whatever images were in the camera buffer when the error occurred. The rest of the images on the bad card are probably still recoverable. Follow the same steps above.
Whatever you do with the original card, do no attempt to reformat it or shoot on it until you can examine it with the proper software later. Both Lexar and Sandisk make very good image recovery software that comes with their cards. The software can recover damanged or even deleted images as long as the card was not formatted and filled again. I personally use Sandisk RescuePro.