2008 Suzuki SX4 shuts off, resumes

I am an owner of a suzuki sx4 and while driving the car just turns off, then after a few seconds will resume running.
the mechanic tells me that it is a electrical problem but is unable to find the fault as the computer wipes the codes once the car shuts down and restartes
has anybody had this problem as it is frustrating me

Ask the mechanic to do a wiggle test while the engine is idling to see if the problem occurs.

If they don’t know what that is, find a new mechanic.

Tester

If the diagnostic codes get cleared when this happens, the main battery power is involved rather than the ignition switch most likely. It’s not uncommon for the battery cables to get eaten away by battery acid with this being the result. 10 year old car, definitely possible.