better error handling for user query