catch errors when invalid path is given