public ClaseUno() { try { ClaseUno.MetodoEstatico(); } catch (DivideByZeroException error) { throw new UnaException("Err 2do ctor", error); } }
public ClaseUno(int n) { try { ClaseUno clase = new ClaseUno(); } catch (UnaException err) //Tiene unaException y el division por inner { throw err; //throw new ClaseUno(3); UnaException("Err 2do ctor", err); } }
static void Main(string[] args) { /*try * { * ClaseUno clase = new ClaseUno(); * clase.MetodoInstancia(); * * } * catch(DivideByZeroException error) * { * Console.WriteLine(error.Message); * } * catch(MiException errorMiException) * { * Console.WriteLine(errorMiException.Message); * Console.WriteLine(errorMiException.InnerException.Message); * }*/ try { ClaseUno.MetodoInstancia(); } catch (MiException miError) { Exception exceptionGeneral = miError; while (exceptionGeneral != null) { Console.WriteLine(exceptionGeneral.Message); exceptionGeneral = exceptionGeneral.InnerException; } } Console.ReadKey(); }