catch exception in algorithm and pass to GUI