Пример #1
0
 public static void Validar(Desarrollador des)
 {
     try
     {
         if (string.IsNullOrEmpty(des.Nombre))
         {
             throw new Exception(des.GetType().Name + " tiene un nombre nulo");
         }
     }
     catch (Exception ex)
     {
         ControlErrores.Imprimir(ex.Message);
         Console.WriteLine(des.GetType().Name + " tiene un nombre nulo");
     }
 }
Пример #2
0
        public void Procesar()
        {
            try
            {
                Console.WriteLine("\n Preocesando el error ");

                throw new Exception("\nCreando un error forzado\n");
            }
            catch (Exception e)
            {
                Console.WriteLine("Error guardado");

                ControlErrores.Imprimir(e.Message); //Al ser un método estático ya no es necesario enlazar en el código
            }
        }