Improved Error Handling in DBQuery and DBStore