Created your exception class
public class HTML_Manager_Exception : ApplicationException { public HTML_Manager_Exception() { } public HTML_Manager_Exception(string message) : base(message) { } public HTML_Manager_Exception(string message, Exception inner) : base(message, inner) { } protected HTML_Manager_Exception(SerializationInfo info, StreamingContext context) : base(info, context) { } } I have two methods:
public static async void BonusTableRefresh(int u_id) { try { LoginBon(u_id); } catch (HTML_Manager_Exception ex) { throw new HTML_Manager_Exception(ex.Message); } } public static async void LoginBon(int u_id) { string login = CryMotherFucker.DecryptStringAES(du["log_bonus"].ToString(), CryMotherFucker.SharedSecret); if (string.IsNullOrEmpty(login)) throw new HTML_Manager_Exception("Для пользователя не указан логин доступа к сайту"); } I need that when throwing an exception in the LoginBon method, it is passed to the BonusTableRefresh method, but for some reason this does not happen, the program simply stops. What's the matter?