[0.0.9m] Add some exception handling around the main SQL routines