Add try-catch for query results.