Ver Mensaje Individual
  #9 (permalink)  
Antiguo 07/07/2010, 09:39
Avatar de alguienmas
alguienmas
 
Fecha de Ingreso: mayo-2009
Mensajes: 62
Antigüedad: 15 años
Puntos: 8
Respuesta: Cómo usar correctamente excepciones ya sean creadas por el usuario o no.

Si lo que buscas es encontrar todas las Exception no debes arrojarlas (throw) debes almacenarla, tal como dice FiruzzZ, claro que yo lo haria distinto.....
Código:
List<Exception> metodo1 () throws MiException {
List<Exception> list =new LinkedList<Exception>();
    if () list.add(new MiException ("Exception 1"));
// en vez de throw new MiException ("Exception 1");
    if () list.add(new MiException ("Exception 2"));
// en vez throw new MiException ("Exception 2");
return list;
}
al ejecutar la funcion te retornara la lista de todas las Exception producidas en esta funcion