Improve error handling in consult/1