function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HugoNowHugoNow 

Not able to put exceptions in a list since Spring '16 update

Hi all,

Last Saturday, our org got updated to Spring '16. I deployed some changes 2 days before and it was working. However, today, I got the following exception from one of my unit tests:

|FATAL_ERROR|System.TypeException: Collection store exception adding Test1Exception to List<java.lang.Exception>

The problem can easily be reproduced by creating the folowing class:
public class Test1Exception extends Exception {
}
Then, executing the folowing code in the Execute Anonymous:
List<Exception> el = new LIst<Exception>();
el.add(new Test1Exception());
We tried to reproduce the problem in a sandbox I created this morning but no luck, we are unable to.
Anyone has this problem?

Thanks!


 
Vishwajeet kumarVishwajeet kumar
Try:

List<Exception> el = new LIst<Exception>(); el.add(new Test1Exception('Some exception Text'));

it works.
HugoNowHugoNow
Hi Vishwjeet Thanks for trying it out. But unfortunately, it does not work in my environement. I get the same exception. Would it be something related to a setting in my Org? Regards *Hugo Charbonneau* www.cogition.com *Software Solutions* *514-699-9695*