Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [exception]

An exception denotes an error that disrupts the normal flow of code execution.

0
votes
2answers
26 views

Insufficient access issue while deleting the record with Public Read/Write sharing settings

User is getting "There's a problem saving this record. You might not have permission to edit it, or it might have been deleted or archived. Contact your administrator for help." exception for a record....
1
vote
2answers
38 views

Cover Error Handling on Test Class

I am having an issue where I have a trigger that rolls up data from contacts to an account. This was working fine with no issues until we added a managed package app that is constantly checking and ...
0
votes
0answers
33 views

@future method not getting called from catch block

I am calling a webservice (synchronous) and in case of CalloutException, I'm trying to create an error log in a custom object. The problem is, the record insertion is happening in a future method and ...
1
vote
2answers
133 views

Exception not being caught; System.FinalException: Cannot modify a collection while it is being iterated

Why is this Exception not being caught? I read that System.LimitException is not caught but didn't see anywhere about System.FinalException. Non-Working Code @AuraEnabled public static List<...
0
votes
1answer
60 views

Read Time Out Exception

I am calling REST API method to update some data to another system from apex but getting "common.apex.runtime.impl.ExecutionException: Read timed out" exception. Here is my request code HttpRequest ...
2
votes
2answers
53 views

Not receiving flow Exception emails

I'm having an issue in my org where I can't make anyone receive the unhandled exception apex emails, so i'm having a test failing on a Process Builder, and I can't fix the issue since I can't receive ...
1
vote
1answer
54 views

Messaging.renderemailtemplate() fails with error: System.EmailTemplateRenderException: UNKNOWN_EXCEPTION: java.lang.NullPointerException

I am trying to render an email using the method: Messaging.renderemailtemplate(), by passing three parameters: templateId,whoId ( user ) ,whatId ( Custom Object ) from a Trigger. The insertion of ...
0
votes
2answers
30 views

Show System error messages in visualforce markup

I wonder, is it possible to show exceptions or any errors, like "Null pointer exception" in visualforce? For now all errors refresh the page and displaying error on the blank page. I want for my ...
0
votes
0answers
68 views

“Connection reset” exception when sending a callout (HTTP.send())

We have been receiving this intermittent exception when trying to make a callout for a few months now ("Connection reset" is the exception message): Connection reset Class.Sip_HttpUtil.callout: ...
1
vote
1answer
56 views

Duplicate Rule Details - How to get in Apex exception

I am getting a duplicate rule issue with apex first error: DUPLICATES_DETECTED, Use one of these records?: [] Now I want this rule to run, however, I need to get the details of the record that is ...
1
vote
1answer
25 views

need to throw an error on specific record from list

I have below method and error is coming beacuse of some validation/trigger is on account and need to catch the exception If i am runnning this from Ui for one record this will throw an exception as i ...
0
votes
1answer
27 views

How to test Exceptions (Query and DML) for ContentDocument?

I try to write wrong query, but I get just error un my test, not coverage. If I use try-catch in unit-test - no error and no coverage either. How to test it right? And how can I test here delete DML ...
2
votes
2answers
222 views

How to capture individual exceptions in bulk record updates

Today I am writing an apex class to transform a bulk set of data from one record to another. During the course of this transfer, it is expected that we will have errors on the records in the system. ...
2
votes
0answers
81 views

Delete __Sharing object

I'm receiving the following error: TR09_MasterServiceAgreement: execution of AfterInsert caused by: System.DmlException: Delete failed. First exception on row 0 with id 02c1800002Lir2PAAR; ...
0
votes
1answer
25 views

How to catch update exception and what kind of notification to do here?

I have a trigger with helper class and test. But I don't know how to test update there and what kind of notification I need. Thanks for any help. Trigger: trigger ArchivedTrigger on Item__c (after ...
0
votes
3answers
45 views

Test Coverage in Select DML Exception

How can we throw DML exceptions in Batch Start method in apex? I want to cover a code using test class which handles dml exception in select query in batch start method. Query is simple select query ...
5
votes
2answers
135 views

Custom Logging, @Future, Transaction Control

I have a similar question to these two: Custom Logging and Future Methods Custom Exception Handling & Logging But my question this time is: can I put the @Future annotation on the Logger Class? ...
1
vote
1answer
21 views

Throwing a CalloutException for Aura Controller

I have an aura controller which calls a Services class. This services class makes a callout to external system and returns a response. public class Anauracontroller{ public resObj callService(){ ...
3
votes
1answer
119 views

Exceptions and DML

It was to my understanding that when you throw an exception all previous operations are rolled back. When an exception occurs, code execution halts and any DML operations that were processed ...
2
votes
1answer
16 views

Will remaining scheduled action fail if an earlier scheduled action fails?

Based on the process below: If the 4th scheduled action throws an exception, will the 5th scheduled action still fire later?
1
vote
1answer
26 views

How to increase code coverage for catch block

I have below Apex class (DAO class) which has a try-catch block. Same try-catch block has been used in 5 different methods. I tried sending setOpportunityId as account id or null id but still, it is ...
0
votes
2answers
39 views

SObject row was retrieved via SOQL without querying the requested field: Campaign_Design_Profile__c.Related_Opportunity_ID__c

I need help troubleshooting the below apex. I have this class being called in a custom JSON Builder on a custom object. I'm logging successful runs in the log in the developer console, but in the ...
0
votes
1answer
22 views

Beautify exceptions from triggers in Lightning UI

I have a function that I fire on an after insert or update of my Inventory__c object public class duplicateException extends Exception {} public static void preventDuplication (List<Inventory__c&...
0
votes
1answer
106 views

Cannot Read Property 'getList' of Null Exception

I have a component which iterates over a list of records and in turn calls a child component for each record returned. This works fine. I also have a lightning:slider in a seperate component which ...
2
votes
2answers
111 views

Not Receiving Unhandled Exceptions Emails

I had have a very minimal code to throw null pointer exception intentionally. The reason was we're not receiving exception emails. We even reached out to support(You know how it can be painful process)...
0
votes
1answer
67 views

Issues in Scheduled Apex

Error:First error: Delete failed. First exception on row 0 with id a2A0R000003T2DMUA0; first error: ENTITY_IS_DELETED, entity is deleted: [] Note: Above error occurs to me as a concurrency Issue. ...
0
votes
1answer
35 views

Attempt to de-reference null object (Custom File Import)

The requirement is to import a tab separated text file and updated the records matching with some statuses then display success to for failure with the list of records. I wrote the following VF and ...
2
votes
1answer
76 views

How to enforce CRUD and FLS in bulk trigger?

How to enforce CRUD and FLS in following situation (bulk trigger). Better idea is simply throw an exception or addError(errMsg) ? trigger CaseCommentTrigger on CaseComment (after insert) { List<...
0
votes
0answers
18 views

How to catch community registration exception e.g.: duplicated username

When I tried to create a new user `` with a duplicated username. The following exception will raise. Your request cannot be processed at this time. The site administrator has been alerted. How could ...
5
votes
1answer
157 views

Not able to catch an exception (Custom + Standard) from trigger

Please consider the below scenario: I have an Application__c object. I have a trigger on that (for simplicity, coded directly in trigger) which does one thing if the record name is Error then throws ...
0
votes
1answer
23 views

How to resolve below Dataloader error

Too many retries of batch save in the presence of Apex triggers with failures: when triggers are present partial save requires that some subset of rows save without any errors in order to avoid ...
-2
votes
2answers
44 views

Null pointer Exception in Apex controller

I am getting "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object" in Apex controller when i click on update link pop up. Its showing in query with " ulstAsset ".I am newbie ...
0
votes
1answer
49 views

How to tell which Validation / Workflow rule caused exception?

I am using a batch class to mass change the case owner from one queue to another, but during the update process I am returned the following exception: FATAL_ERROR System.DmlException: Update failed. ...
0
votes
0answers
62 views

RunTime exception for Converting String to Boolean

Public static void createDiscrepancy(Id ndcId,Map<object,String> mapOfParameters){ try { ...
2
votes
0answers
200 views

Not receiving Apex exception emails

I am unable to receive any Apex exception emails in both my own dev playground org and the sandboxes/production org for the company I work for. I remember at my last company I would receive exception ...
2
votes
2answers
185 views

Getting the row culprit of an insertion failure [closed]

Sometimes some of my orders and contracts are not define in the same date terms. That causes my system to throw an exception as follows: Message: Insert failed. First exception on row 8; first ...
0
votes
0answers
23 views

Throwing Custom Exceptions From Post Install Script

We have created a post-installation script for a Managed Package. As we are using lightning components in my package, the domain must be enabled. In post-installation script, we are checking whether ...
0
votes
1answer
39 views

Out-of-the-box way of storing exceptions caught in a lightning component

Normally, we want to catch apex-side exceptions and throw it gracefully to the lightning component. But my requirement is to catch errors/unhandled scenarios in the lightning component and store those ...
8
votes
2answers
507 views

Catching an UnexpectedException?

My specific questions are (for the below detail): Anyone have any idea why the design is like this? Is the only solution to always clean the content perfectly before saving it? This type is not ...
0
votes
0answers
53 views

Developer script exception - Invalid type: Component.Apex.Page

I've been receiving quite a lot of these recently as emails from a client org. This is the content of the email that I get Developer script exception from "client organization name" : "my apex ...
4
votes
1answer
737 views

Try, try, catch, catch

Given the following code, what does the developer expect will cause block C to execute: try{ try{ //code block A }catch{ //code block B } }catch{ //code block C }
11
votes
2answers
327 views

When are unhandled exception emails suppressed and not sent? or Why do I not always get exception emails even though I've set them up?

The Background According to the help docs When unhandled Apex exceptions occur, emails are sent that include the Apex stack trace and the customer’s org and user ID. However I frequently ...
3
votes
2answers
423 views

Apex InvalidParameterValueException class constructor parameters?

What are the constructor parameters for the InvalidParameterValueException class? InvalidParameterValueException e = new InvalidParameterValueException('param1', 'param2'); e.setMessage('parameter ...
3
votes
1answer
96 views

Managed Package: Catch exception and then re-throw asynchronously?

I'm working on a managed package in which our customer (the company that asked us to develop the package) runs into certain exceptions in edge case UAT scenarios (e.g. API has gone bonkers for 10 ...
0
votes
2answers
185 views

Malformed JSON: Expected '{' at the beginning of object

I am getting the Malformed JSON error on the below class: public with sharing class SettlementReports { /* variables */ public Id settlementBatchExternalId; public Id ...
0
votes
1answer
39 views

Exception thrown when querying KnowledgeArticleVersion with a file custom field and data category selections

I am running into a very strange error where I am getting an exception in an Apex controller when I am trying to access the results of a relationship query. I have narrowed down this issue to ...
0
votes
0answers
126 views

Salesforce Community - Lightning template - Insufficient Privileges - URL No Longer Exists

I'm experiencing some undesirable behaviours with Lightning community. We have a community that uses a Lightning Templates(napili), and our undesirable behaviour comes when an user try to input the ...
-2
votes
3answers
155 views

Can I throw custom exception inside a loop?

I've created a custom exception class by extending Exception {} my question is, can I throw a custom exception inside a loop. does Apex consider throwing a custom exception as a DML operation Below ...
1
vote
1answer
194 views

Database.SaveResult with Try/Catch

I have been working on trigger, and using Database.SaveResult with addError to show error on the UI. However, Database.saveResult handle all the DML Exceptions. If some other exception what is the ...
2
votes
1answer
78 views

Apex Rest: Attempt to de-reference a null object

I am building a Apex Rest Endpoint. I am receiving an "Attempt to de-reference a null object" on the following line: cm.rsmEmailOpenCount__c += 1; I dumped all of the Objects (Lead, Campaign and ...