Hi there, as for the formatting error that happens when erasing the SD cards, the simplest way is to reboot your Mac and then continue the erasing work one more time. If this solution fails, it might be the fault of the SD card slot. Go out the buy a new SD card reader rather than replacing or fixing the SD card slot. The cost to repair or replace an SD card slot can be very high since you need to replace the whole logic board.
Hope the SD card formatting process goes well~