catch errors thrown by modifyFn