void SomeMethod(out string errorMessage) { try { // some code } catch (Exception exc) { errorMessage = "Some error occured"; } }