Rewrapped category search in try except for error catching