Handle exceptions in SearchCommand