Questions tagged [exception]

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

Filter by
Sorted by
Tagged with
3
votes
0answers
72 views

Exception.getStackTraceString() returning '()' on object with managed package trigger when debug logs not on

First of all, my question is very similar to this one and might actually be a duplicate, however there is no notion of a managed package or debug logs there. We have an after insert trigger on ...
2
votes
1answer
21 views

What is the correct way to return validation errors from a lightning Apex controller?

What is the correct approach to return validation errors from lightning controller? Suppose we have an aura method that takes some parameters. We need to validate these parameters in order to make ...
4
votes
0answers
38 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
1answer
245 views

Is it Possible to Catch an Unknown Exception?

I am creating a button that will allow System Admins to reset user passwords via System.resetPassword. We have password restrictions setup such that a password must exist for 24 hours. Therefore, if ...
0
votes
0answers
20 views

Groups object upserting return INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY exception

I use Salesforce SOAP API and try to upsert Groups. I just get data from Salesforce: "LastModifiedDate" -> "2018-04-15T11:35:25.000Z" "SystemModstamp" -> "2018-04-15T11:35:25.000Z" "...
0
votes
2answers
29 views

Catch System.LimitException in Batch to send error via Email

I created a batch that processes data based on certains parameters sent by the user and then sends the result via email. But sometimes the parameters are too ambitious and the batch throws a System....
9
votes
4answers
92 views

Run more than one async jobs from Future/Quable context

We have created a process which must work asynchronously (limits and architecture reasons) and it was working fine. Some time later we have started to work with BigObject. And as long as writing to ...
0
votes
1answer
27 views

How do I check if a list-value from my Map is empty?

I get this error in case if Opportunity__c has no OpportunityInfo__c. I try to check it with the condition if(opportunitiesMap.get(actualTool.Rent__r.Opportunity__c).OpportunityInfo__r != null), but ...
0
votes
1answer
21 views

Custom exception on Service Response with Standard API

Using standard API, when i receive a POST, if things go wrong i must return an error response. Since i'm not using a custom web service but a TriggerHandler, when one of the required parameters isn't ...
0
votes
1answer
29 views

Cannot bypass 'Duplicate Username' Salesforce error on before insert User Trigger

As per standard functionality, when one tries to create/update a user record with a username value that is NOT unique across all Salesforce orgs, then the following error message is returned: ...
0
votes
0answers
48 views

How to fix exception-field integrity exception: Type, Quantity, unknown

I am getting the error ( field integrity exception: Type, Quantity, unknown ) while creating an opportunity line item schedule in a flow in production. I am unable to reproduce this issue in sandbox. ...
1
vote
0answers
32 views

Callout Exception when testing

I use a webservice to validate government info on companies. This is used for accounts and Cases. For some reason I'm getting this calloutException but there's no DML before the callout. I'm getting ...
2
votes
1answer
80 views

How to stop Code executing once I catch an exception?

I am attempting to display an error message on a VF page if I get a time out error from an api call. I am using try catch, to get to the exception, but I would like to stop further code execution ...
-1
votes
1answer
30 views

Error Handling in methods that return account

I have an Apex method that receives an Account record as input and returns Account record. What if an error occurs and i want to return it to the user? I cannot return String, since the method returns ...
0
votes
1answer
87 views

Can't get Platform Event Retries to work?

I am not seeing any evidence that processing continues after I raise a EventBus.RetryableException. Logs indicate the retry event is thrown, then nothing. My test class, which is the same as ...
2
votes
1answer
51 views

How to disable constructors in custom exceptions?

There is a lot out there on how you can't override exception constructors and how to do custom exceptions, but I haven't been able to find anything on disabling a constructor for an extended class. I'...
0
votes
2answers
44 views

Why catch code of an try catch exception are not executed when System.LimitException: Too many DML statements: 151

I have the next code block that generates a limitException: Account myAccount = new Account(Name = 'MyAccount'); Insert myAccount; For (Integer x = 0; x < 150; x++) {Account newAccount = new ...
0
votes
0answers
328 views

sfdx force:source:deploy fails with UNKNOWN_EXCEPTION

Yesterday it worked, but when I deploy my DX projects to my Sandbox using sfdx force:source:deploy -p ./force-app -l RunLocalTests -u TargetOrg -w 15 it fails with: === Component Failures [1] TYPE ...
0
votes
0answers
65 views

System.DmlException: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record in Apex

Full Error message: System.DmlException: Process failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving ...
4
votes
0answers
89 views

Getting full stack trace in BatchApexErrorEvent

I am using the BatchApexErrorEvent to get the stack trace of the exception but it only gives the line from where the issue is generated. { ReplayId=12, CreatedDate=2019-06-18 12:45:24, ...
0
votes
1answer
25 views

SObjectException

As per my understanding, the below code should throw System.SObjectException: SObject row was retrieved via SOQL without querying the requested field, but instead it updated the account phone without ...
-1
votes
1answer
63 views

Database.Upsert not able to prevent AllOrNone

Elaborating the Question:- We have 3 Objects, Branch, Account and Branch Accounts, Branch Accounts is a junction between former 2. Now we are trying to insert Branch Account records via Batch, and in ...
2
votes
1answer
48 views

How to send debug log with email

Assume that We have try catch structure and if exception throw, I want to send all debug log in email as an attachment. Is that possible?
0
votes
0answers
37 views

exception when sending email from Apex when setWhatId is set with recordId

i'm getting an exception when sending email from apex controller class. I'm associating this email with recordId to show it under activity for that record. here is the exception System....
0
votes
1answer
22 views

Unable to update existing(Or) related leads while lead convertion

Currently, I'm working on the parent-child relationship on the lead object. So, we are restricting users to convert only master lead & then top 20 related leads will be converting as contacts to ...
1
vote
0answers
37 views

Reload Visualforce page on session lost

Im trying to reload a Visualforce page when session is lost, due to another login, and sessionId created in a different browser tab. I have code that makes constant calls to the controller methods, ...
3
votes
1answer
350 views

What are “LOB fields” in an asset? Querying all the fields on the asset causes a limit exception, why?

First of all: what are LOB fields? Secondly: I have a complex apex automated process in which I need to make an exact copy of an Asset object (all of its fields). To do this I created a method that ...
8
votes
0answers
94 views

Rethrowing an exception is missing the stackTraceString

I have code that is wrapped into a main try-catch block and then inside of that I have another try-catch which I am using for a specific use case. If the inner try-catch gets triggered I then use a ...
0
votes
2answers
150 views

Create exceptions in test classes for a process builder?

Is is possible to create exceptions in a Test Class for (example) Process Builder "XYZ NAME"? To avoid the test class running that process. Right now my work-around is to manipulate the criteria in ...
8
votes
3answers
347 views

How to Aura Handle multiple DmlExceptions

How should I handle multiple DmlException messages when using AuraHandledException inside an Apex Controller. If I do this: try { upsert value; } catch(DmlException e) { throw new ...
1
vote
3answers
713 views

System.AsyncException: Maximum stack depth has been reached. while writing in test class

I've got a requirement to perform queueable apex in a trigger my class working fine, but while writing a test class for queueable apex I'm getting an exception. Could anybody can help me. Trigger ...
2
votes
1answer
51 views

How to throw or cause an Access Level exception in a test class

anyone know how to throw an access level exception in a test class to cover the below code sample? I'm assuming the object being inserted with Database.insert needs to have sharing settings modified ...
0
votes
0answers
192 views

Exception method getStackTraceString is empty ()

I'm sending any errors that our try/catch blocks catch to Slack and for some reason all the Exception info is filled out apart from the getStackTraceString method. It's a method within a class: try {...
0
votes
2answers
142 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
61 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
91 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
255 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
540 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
341 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
257 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
36 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 ...
1
vote
0answers
367 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: ...
2
votes
1answer
698 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
40 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
178 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
2k 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
219 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
31 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
317 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
382 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? ...