Questions tagged [exception]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
43 views

Handling FIELD_INTEGRITY_EXCEPTION with try catch and logging errors

I have got an apex trigger that sometimes errors with System.DmlException: Update failed. First exception on row 0 with id 00Q0800000fhnM2EAI; first error: FIELD_INTEGRITY_EXCEPTION The reasons for ...
0
votes
1answer
25 views

How to handle validations from trigger to show as exception or toast on managed package layout

I currently have a custom pagelayout from a managed package. In this pagelayout a list of records can be selected to create new records for another object. I have a before apex trigger in which I want ...
1
vote
0answers
54 views

LWC Flow Control - Finish throws exception

THE CONTEXT: I am creating an LWC as a screen flow element. The LWC is very simple, it displays in a radio button group all of the existing Opportunity record types. Once the user selects a record ...
-1
votes
2answers
55 views

DML in a future method will be rollback if after there's a throw exception

My classA calls classB which calls a future method inserting an object, later in classA it throws an exception, and I saw my DML in future method is also being rollbacked. Is there anyway to commit ...
0
votes
0answers
17 views

I have this custom controller for a vf page please help me to write the test class..actually I have written but not covering else and catch [duplicate]

@isTest public class LoanPaymentPdfControllerTest { @TestSetup static void testSet(){ // create Account Account accnt = PFSTestHelper.getAccount(); insert accnt; ...
0
votes
2answers
57 views

Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions

I am currently facing an issue while trying to update the criteria of a SOQL query and was wondering if anyone could help me out. To provide some context: I am building an automation to propagate ...
0
votes
1answer
38 views

Exception during test execution: ConnectApi.ConnectApiException: INVALID_API_INPUT - Order is not Activated

This is how we are activating the order in the test class // update order status to activated List<Order> lstOrderToUpdate = new List<Order>([SELECT Id,status,AccountId FROM Order WHERE Id ...
1
vote
1answer
76 views

throwing aurahandledexception is not sending message correctly to LWC

I am calling an apex controller, that has several try-catch blocks that throw exceptions depending on the error or situation, (i am also throwing outside of try catch blocks) this is an example: try{ ...
0
votes
0answers
24 views

Can't generate a CSV from a Report record

I've written an invokable APEX method that: (a) generates a csv from a report record (b) sends an email to an address with the csv file as an attachment (c) marks some subscription records as exported ...
0
votes
1answer
36 views

Handling Exceptions From Different Parts of the Code

I've got a case where different parts of the code need to handle exceptions differently, and was wondering if there is a pattern or a recommendation for approaching the problem. Let me explain exactly ...
0
votes
0answers
24 views

Generating a CSV through a report inside an invocable method THROWS exception, but in a normal method it doesn't!

I am trying to generate a CSV through an InvocableMethod but it throws an exception. If the same code runs in a normal method, then no exception is thrown. In the following code for example sendEmail2 ...
0
votes
2answers
70 views

Null pointer exception inside for Loop

Here is the code: for(Requests curRequest : requestList){ if (curRequest.varSRProduct!= null ){ for(SObject so : curRequest.varSRProduct){ //code } } ...
0
votes
1answer
138 views

Apex classs exposed as Rest API giving 404 error on call

I am trying to test my Apex class code exposed as rest api. For this, I am making a call to this API using postman. Below is the class I created @RestResource(urlMapping='/SurboChat/SaveChatTranscript'...
1
vote
1answer
51 views

List has no rows for assignment exception on AuraEnabled method

I have created an Apex Class with an AuraEnabled method, which I am calling from a Lightning component. After the method is called I am receiving the below error. There was an exception List has no ...
0
votes
3answers
872 views

Type cannot be constructed: Exception

In Apex I have this: ... if (forceException) { Integer a = 1/0; } ... But after I ran SFDX Scanner I got an error that variable a is defined but not used (UnusedLocalVariable) so I decided to do ...
0
votes
0answers
212 views

error: Illegal assignment from Object to Map<String,String> [duplicate]

String input = '{"orgId":{"isRequired":"true", "valiateDataType": "Id"},"numOfVehicles":{"isRequired": "true"}}'; Map<...
1
vote
0answers
156 views

Change data capture event not firing associated trigger in production

I have a custom trigger that fires on an OpportunityChangeEvent: trigger EXAMPLE_CREATE on OpportunityChangeEvent(after insert) { // Get the change event’s product ID for added and updated products ...
1
vote
1answer
95 views

multiple addError() behaviour in apex

We have a trigger on the Account and Contact objects. The job of these triggers is to prevent the deletion of Account and Contact objects depending on the criteria. Account should be deleted if no ...
2
votes
1answer
51 views

Method not getting called after addError, Please advise

I am new to SFDC please help. Requirement: Restrict user deactivation if Account is owned by the user and send an Email with details. Trigger on user object: trigger userTrigger on User (before ...
0
votes
1answer
84 views

JS Promise.all and a combination of failed and successful Apex calls: how to deal with that?

In the controller of a LWC, we use Promise.all to call an Apex method with different inputs. The code for this: const funcs = productCodesBatches.map(productCodesBatch => getSearchResultsBatch( { ...
0
votes
2answers
107 views

CPU Timeout Error for 9k records after resolving Too many DML rows: 10001

What do I have? Two objects ObjectA and ObjectB without any trigger/process builder/flow. I create a trigger on ObjectA to create the same number of records on ObjectB What is my test case? Insert ...
0
votes
1answer
53 views

Facing Mixed DML operation for apex class

I have written a scheduler for deactivating salesforce users who doesn't logged in for last 90 days. The code is working as expected if I remove exception logging into a salesforce object at line #14. ...
0
votes
1answer
152 views

Logging Apex exceptions through Event Bus while still rolling back the entire transaction?

I'm working on implementing a robust error logging framework for our org using Platform Events to ensure that we always capture errors in our code even if the transaction is rolled back. If I use ...
-2
votes
2answers
569 views

Apex error : You have uncommitted work pending. Please commit or rollback before calling out [duplicate]

Apex error : You have uncommitted work pending. Please commit or rollback before calling out. I get the above error when I try to make two http callout one after the other and store the result in ...
0
votes
1answer
36 views

AuraHandledException message: extra word ("Exception") at beginning of message

I am working on a component+Apex class. I need to throw an error message via AuraHandledException. Everything seems to be working fine except for the error message itself: it's showing up with an ...
1
vote
1answer
191 views

Apex safe navigation operator chaining

I'm a little bit confused. Let's say we have a code String[] recordTypes = AppConfigData__c.getValues('dummy')?.value__c.split('\\s*;\\s*'); Why it works even if getValues() returns null? Why split ...
0
votes
0answers
84 views

getContent() throws ApexPagesGenericException 404

When trying to retrieve a json file from a zip file, I get the following error: Error: System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException: 404 status code return from ...
3
votes
1answer
91 views

Latest on reviewing errors in a managed package

I know this has been discussed before but all of the threads are several years old. I couldn't find a finite answer and also I am trying to find out if anything has changed since. I am trying to ...
1
vote
0answers
83 views

Updating Opportunity Splits in Apex field integrity exception

I'm trying to automate Opportunity Splits and I'm running into the following when trying to upsert them for a given split type: System.DmlException: Upsert failed. First exception on row 0 with id ...
0
votes
1answer
137 views

Prevent a rollback of an inserted record due to an exception [duplicate]

I have a LWC component which calls an apex class that does callout: public static List<Case> doCallout(List<Case> cases) { ....... CalloutLogger.insertLog(req, res, time); ........
0
votes
1answer
93 views

LWC - Exception when calling child function more than once

I'm having an issue while developing an LWC and was hoping someone could help as the error isn't super clear to me. I have LWC A which contains LWC B (check example code below): <div ...
0
votes
1answer
118 views

Throw an exception in Apex if attachment is null

I have a Visualforce form that takes attachments of which I need to make required in order for the user to proceed to the next screen. Since the record doesn't get inserted until the end of the multi-...
0
votes
1answer
66 views

How to get the inner exception?

So I catch a DMLException which is caused by a custom exception from a managed package, now how can I get that custom exception? Here is the log: 18:33:24.391 EXECUTION_STARTED ... 18:33:25.710 ...
0
votes
0answers
34 views

Catch exception inside record-triggered flow and provide custom message instead of standard

Let's say we have record-triggered flow that updates unique field. Is it possible to provide custom error message when flow faced DUPLICATE error ?
3
votes
3answers
657 views

try catch finally and inserting records

We have an error log object where we store the errors and I have a simple try catch like below... My issue is that the insert in the finally does not appear to be happening. Any advice? or is that a ...
0
votes
0answers
338 views

Why aren't I receiving flow error emails in my sandbox?

I have a Process Builder that is failing to complete when a record is created, when I attempt to create the record a failure message is returned "We cant save this record because PB-NAME has ...
0
votes
1answer
132 views

How can I avoid error "sObject type 'StaticResource' is not supported." in the Post Install script?

I am sampling data inside the Package Post Install script from a Static Resource, but script fails with an error: Error Message: common.apex.runtime.impl.ExecutionException: sObject type '...
0
votes
1answer
184 views

Handling errors in the Flows

I have a simple flow which jsut updates the record. But when updating the records if it fails the users were getting unhandled error exception. Like below An unhandled fault has occurred in this flow ...
0
votes
1answer
44 views

Is there something similar to Add Error that doesn't prevent DML Operation

How can I do something similar to id.addError without preventing dml operations? Long story short, I have a screen flow that updates a Case record and I want to be able to tell users that the ...
0
votes
1answer
114 views

System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY>

I'm writing test class for one of my method and getting this error: Method: public String onLoadLog(String loaddata) { Map<String, Object> LogData = (Map<String, Object>) JSON....
0
votes
1answer
196 views

Exception Handling in Auto Launched Flows

Account accountRecord =[Select Id From Account Where Id='001ABCABCABCABYAAQ']; The above code results in an Exception(System.QueryException) in Apex as there is no Account with the given Id. But it ...
0
votes
1answer
196 views

Execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors ()

I have created a trigger on the Opportunity object for before insert and before update, through which I am sending the Trigger.newMap variable as an argument to my apex class where I am checking the ...
0
votes
0answers
175 views

Unknown exception in SendMail method: List index out of bounds

I am facing the current error with the Messaging.sendEmail method: Error Occurred: An Apex error occurred: System.EmailException: SendEmail failed. First exception on row 0; first error: ...
0
votes
1answer
14 views

exceptions and scheduled jobs

I know if there is an unhandled exception it will "roll back" any dml operations that occurred during the same transaction. Does this also include scheduled jobs? I'm not sure if scheduling ...
0
votes
1answer
21 views

Visualforce behaviour when expections are caught

I made a really weird discovery and i wanna ask if this is true and how to handle those situations. If a VIsualforce page invokes an Apex method via commandButton or acionFunction, if an exception was ...
1
vote
0answers
44 views

System modify all data permission does not seem to be working

I am trying to update activities (tasks) using the bulk API utilizing a client. It seems to be working however I am getting a few thousand records that are returning an error : Unknown_Exception: An ...
1
vote
1answer
140 views

MIXED_DML_OPERATION : Can not insert a user record from account trigger even when User Role is null

I am trying to create a community user in an after update trigger of account. I am setting the UserRoleId = null but still am getting MIXED_DML_OPERATION exception. As per documentation: You can ...
2
votes
1answer
114 views

Stubbing Logger classes with methods accepting Exceptions

I recently needed to write a test that checks if an exception gets logged. We have a Logger but it's built with static methods, so it cannot be stubbed. But I didn't want to test the Logger logic, so ...
-1
votes
2answers
96 views

System.QueryException: Implementation restriction: ContentDocumentLink?

I have been following this to create a lightning component for lighting:file upload. As you can see there's comments on how to avoid the System.QueryException yet I still am getting it? picture of ...
4
votes
1answer
182 views

Do we really need to wait up to 24 hours for Apex Exception Emails?

For a feature I am working on, I've been instructed to handle errors by sending emails using the Apex Exception Emails, so when an error occurs, I'm "handling" it by throwing a custom ...

1
2 3 4 5
11