move sql error handling up a level into _raw_select