Catch error from exec