skip question when error in choices function
Hi,
I have a question with choices as function. This function fetches answers from a remote server which might be unavailable or the query to the remote is invalid. This question is part of a qustions array. I want to catch an error in the function of the choice (not a problem), write it to the user. and skip the question and moving to the next one. I can put the check in the when, but it's a time-consuming check and I don't want to do it twice both in when and in choices. Is there any way to handle this? or just by opt-out from the array way of prompting?
Thanks.
How about you do this processing before calling inquirer.prompt()?
I can't do it before because the choices are based on previous answers. I ended up putting the logic of the choices inside the when and if there was an error I returned false. If it worked I just store the choices in a var and just use it in the choices. You can see the full code here: https://github.com/teambit/bit/blob/master/src/interactive/commands/init-interactive.js#L51 It was great if I would have an API like this.skip function inside the choices function.
@GiladShoham "page not found"