Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [try-catch]

try-catch is used to catch the exception.

5 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
1k views

Unable to cover Clone() method in test class

I'm having a simple code where I'm cloning an opportunity object with the necessary child elements. When I'm writing a test class for it, the clone method is not called and it is going into catch ...
0
votes
1answer
216 views

error message show if cityname is already exist on vfpage

want to show error message that if cityname is duplicate then show error message cityname already exists! whats i'm doing wrong anyone please tell When saving record from cities tab and if dupicate ...
0
votes
1answer
102 views

insert and updat unittest not covering. adderror why?

Why is my catch not working on the adderror on contentversion see: trigger NoteOnContentversion on ContentVersion (before insert, before update) { for (ContentVersion c : Trigger.new) { ...
0
votes
0answers
45 views

Issue with a Try Catch Block

I recently am developing a code to insert custom records. Based on this insert it will trigger many apex classes. There can be some issues with other Apex classes when they get executed. So i handle ...
-2
votes
2answers
2k views

how to cover catch block in this method in test class

public pagereference savePassword() { if((objAccountTemp.Contact_Name_1__c != null && objAccountTemp.Contact_Name_1__c != '' && objAccountTemp.Affiliate_User_Name__c != null &...