Questions tagged [try-catch]

try-catch is used to catch the exception.

8 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
42 views

Is this a good Model for “Guaranteeing” Record Updates Don't Fail due to ROW_LOCK/Race Conditions?

Background: The zqu__Quote__c object in our org has two child objects from another managed package we use for eSignature and credit card capture. One of those two child objects collects the Credit ...
3
votes
0answers
34 views

Best approach to handling Post-Install script exception

As inspired by this post on when to use try catch blocks, if we have a post-install script for our managed package, what's the best approach to gracefully catching and handling an exception? It ...
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
0answers
21 views

Marketing Cloud - triggered send email template error handling

I have a triggered send email consisting of Ampscript, in this template we are using a lot of personalization which is coming through XML in the triggered send data extension. So the issue is if the ...
0
votes
1answer
313 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
115 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
46 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 &...