我在找上如何处理Java异常的情况下的建议,其中Java自定义异常处理
Class A.test()
{
ClassB.test1()
}
test1()
{
Map listOfExceptions = new HashMap();
for()
{
try{
}
catch(custException e){
// I want the for loop to continue even if there is an exception
//So I am not throughing now rather adding the exception message to map with
//the field name for which for loop is running as key and message as value
{
}
// at some point if map has >0 records I want to throw an exception to classA.
}
所以这里的问题是我怎么可以在地图数据添加到抛出的异常?基本上我需要将异常列表发送到调用方法,作为异常处理的一部分。 有没有办法可以做到这一点? 如果答案是众所周知的,这可能是一个非常愚蠢的问题,但我力求在任何地方找到确切的答案。
是这个java代码? – Prasanth
此Java代码不会编译。 – 2012-10-11 08:19:23
我认为(公平)这是Java-ish伪代码 –