Database exception restructure