Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

@inquirer/search - exit on source failure

Open robcresswell opened this issue 2 months ago • 2 comments

Sorry, this is probably an incredibly naive question; if the source() method fails for some reason (dead network for example) and I want to force exit the prompt; how does one do this? source() seems to catch all errors and just print the message to the terminal, which isn't very helpful. Aside from process.exit-ing, I can't figure out what to do.

robcresswell avatar Oct 22 '25 10:10 robcresswell

That's actually a very good question.

Right now we catch the error and display it; but there's nothing the user can do if the failure is constant and not specific to the search term (or intermittent.)

There's a good question about what inquirer should do in a case like this... We could for example let the user enter to exit. But between this and doing nothing leaving the user ctrl-c, I'm not sure it's worth it?

SBoudrias avatar Oct 24 '25 18:10 SBoudrias

Honestly I kinda think the prompt should exit. Maybe some kind of specific error type? It feels quite user unfriendly to me to leave a user in a dead prompt right? Especially when the software itself could account for that state

robcresswell avatar Oct 25 '25 07:10 robcresswell