improve error handling in sqlite driver