You need to sign in to do that
Don't have an account?
alibzafar
Throw an exception Error
Hi,
I am receiving this error in my test class , when I want to throw exception in try {}.
Here is my code
@isTest(seeAllData = false) public with sharing class MyClass_Test { private static testmethod void loggerTest(){ Test.startTest(); try { throw new Exception('testing'); }catch (Exception ex) { MyClass.myMethod(ex); } Test.stopTest(); } }
Error receiving
Save error: Type cannot be constructed: Exception.
Can anyone help me on this.
Thanks
Ali
This issue is solved now , just made a new class that extends exception class.
And than changed my test class code to ,
I have put the solution, so this might help any newbie.
Thanks
Ali