Questions tagged [exception]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
19 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
14 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 ?
1
vote
3answers
243 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
25 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
23 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
23 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
37 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
20 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
62 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
26 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
30 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
13 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
20 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
29 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
42 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 ...
0
votes
0answers
25 views

How can I find out what “uncommitted work” is allegedly pending?

I have two schedulable batch processes, identical in every way except one is for Opportunity and the other is for Appointment__c. In real life, both batch processes work exactly as expected, which is ...
2
votes
1answer
41 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
55 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
143 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 ...
0
votes
0answers
48 views

Batch Apex Too many SOQL Queries: 201 on a relationship query

REQUIREMENT Create a batch apex class that needs to update all of the accounts based on the number of contracts and opportunities for that certain account. Here is what I have so far. However, I am ...
1
vote
1answer
306 views

Error deploying LWC in change-set. Programmer error: Cannot compare savepoints from two different transactions

I have two Lightning Web Components that consistently fail when I try to deploy them in a change-set. The two LWC are the only components being added in the CS and the error is consistent. Everything ...
5
votes
2answers
124 views

Salesforce Exception Emails Don't Send

Several months ago, we noticed that our production org was not sending exception emails though we regularly were able to generate an exception email in sandboxes. We filed a case with support and ...
1
vote
2answers
114 views

Query Exception : Non-selective query against large object type (Even with the correct way of handling)

I am getting System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field ...
0
votes
0answers
40 views

Access Named Credentials with merge fields [duplicate]

I am on a task where I need to call an external webservice that takes the username and password in the request body, not as part of Authorization header. I did setup the username and password using ...
0
votes
1answer
16 views

Running describeReport(3-arg); of Salesforce Reports and Dashboard API, gives an error(in the SS). Any idea why could this be happening?

------------------------------------------------- Please consider following before answering: The same code runs when invoked through anonymous code window in devConsole. "Run reports" ...
1
vote
1answer
42 views

DML in loop in a batch process

I was working on something entirely different, wrote a test code and found a gap in my knowledge. Hoping someone can point out where and why my understanding is wrong. I have a batch job, it queries ...
0
votes
1answer
882 views

TRANSFER_REQUIRES_READ, The new owner must have read permission: []

I am getting this error while changing the owner of a record by the selected user. So basically I don't want to change an owner or show a custom error message if the user do not have access or which ...
0
votes
0answers
24 views

Custom Exception

I have started learning custom exception. I try to display only the exception message for my program. my code: public class AccountContactHandler { public List<AccountContactWrapper> ...
0
votes
2answers
32 views

System.LimitException: Too many Email Invocations: 11

// Original Code for(Account obj :updateAsDuplicate){ obj.Duplicate__c = true; for(String oldStr : hasExternalIdOldSet){ if(obj.Id.equals(duplicateMap.get(oldStr))){ ...
0
votes
2answers
66 views

“Too many SOQL queries: 201” while running batch - how to fix this code?

I want to test my method and I have this error: FATAL_ERROR|System.LimitException: Too many SOQL queries: 201 Class.PatchPanelTriggerClass.deleteDuplicates: line 202, column 1 Class....
0
votes
0answers
136 views

Einstein Bot, general error handling

i've made a bot that execute some call to Apex Classes methods, and redirect user through different dialogs. For example, when an Apex Actions lasts more than 10 seconds, an exception will be raised ...
3
votes
0answers
210 views

How to gracefully handle custom Apex exception from Apex Action in a Flow

Prelude We have a button on the Account object which kicks off a Flow whose only job is to call an Apex Action. Inside the invocable Apex class, there is much weeping and gnashing of teeth, after ...
0
votes
1answer
35 views

System.CalloutException when making Apex Callout

I have a Apex Callout like bellow which calls the external System API with OAuth2. I am trying to use the Access token if it hasnt expired and generate one if it is expired and store into a encrypted ...
0
votes
1answer
33 views

Getting a null pointer exception

I was trying to fix a null pointer exception here if(com.Employee__c != null && (mapEmployees.containskey(com.Employee__c) == null || (mapEmployees.containskey(com.Employee__c) != null &&...
0
votes
0answers
34 views

Return ContactPhone from Case Object as an output value

I have the following code to output ContactPhone from Case Object, I want to return that value as an output value in Einstein Bot to display a message with this returned ContactPhone value. The ...
0
votes
1answer
31 views

How to construct an exception in Test Class

I want to cover the following lines of code: @TestVisible private void sendEmailToAdminOnFailure(Exception e){ String body = ''; body += 'Failure:--------------->'+e.getMessage(...
0
votes
1answer
54 views

Aura Client Side Javascript Unhandled Exceptions

Is it possible to handle unhandled exceptions within Aura Lightning Components client-side javascript code, without wrapping every piece of code in try/catch? We have a few old LCs which operate on ...
-2
votes
1answer
126 views

Test Class to execute catch blocks [duplicate]

I have a Apex Class like below for handling the exception public class updateCaseRecord { @AuraEnabled public static void updateCheck(String caseId, String Status){ String msg = ...
0
votes
1answer
71 views

How to cover Catch exception in a test class

Below is my code Apex class global class CasinoFeeReminderScheduler implements Schedulable{ global void execute(SchedulableContext ctx) { try{ CasinoFeeReminderEmailBatch batch = new ...
0
votes
1answer
442 views

How to advoid Maximum view state size limit (170KB) exceeded. Actual view state size for this page was 292.001KB

I currently have an apex class which creates an object record and attaches 2 files. I added a loop to be able to have the option to add more attachments based on counter. I currently have some ...
0
votes
1answer
65 views

You have uncommitted work pending. Please commit or rollback before calling out. Apex Batch

I have a little problem with my batch: List<String> idList; public My_Batch(List<String> ocIdList) { idList= ocIdList; } global Database.QueryLocator start(Database.BatchableContext ...
3
votes
1answer
863 views

“Can only throw this exception type from VisualForce or Aura context” error on sfdx force:source:push

Our CI (Continuous Integration) build has started failing today on the sfdx force:source:push with this error: cvnp.ContentDocumentLinkTrigger: System.LimitException: Can only throw this ...
1
vote
2answers
180 views

Is it fine to create a custom exception class that has the same name as a built in one in apex?

I need to throw exceptions within my apex classes here and there, as most of us do. In fact, we can't throw built-in exceptions so we have to create a custom one that extends from the main exception ...
-1
votes
2answers
42 views

Can't cover DMLException with my test

I'm trying to cover my Exceptionm But I don't know. how to do this. When I try to insert a record without Required fields, I get the System.DmlException: Insert failed. First exception on row 0; first ...
0
votes
0answers
90 views

A callout was unsuccessful because of pending uncommitted work related to a process, flow, or Apex operation [duplicate]

I am trying to write a unit test for my apex class but getting above exception. I am trying to insert a batch of big object records through trigger when the custom object record is inserted. below is ...
0
votes
0answers
29 views

How to extend standard Exception for custom messages and logging in an API?

I have been trying to rewrite some older api - just starting with rewrite of error messages and logging. I saw a lot of duplicated code with error responses and logging, so I decided to separate it ...
1
vote
1answer
285 views

savepoints and rollbacks with future methods - does it rollback changes from other transactions

According to salesforce docs on savepoints and rollbacks: Apex gives you the ability to generate a savepoint , that is, a point in the request that specifies the state of the database at that time. ...
1
vote
1answer
518 views

Throw a DML exceptions in Apex Batch Class for testing

Below is my batch apex class that updates Account object for example: global class abc implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database.BatchableContext ...
1
vote
3answers
192 views

Is it possible to cause an exception on a SOQL select statement?

I'm working on writing tests for someone else's code and they have an try/catch around a SELECT statement. Is it possible to ever get an exception in something like the below code block as long as it ...
2
votes
1answer
2k views

Unable to tunnel through proxy. Proxy returns “HTTP/1.1 503 Service Unavailable”

I'm perfoming a HTTP GET callout to an external cURL connected through proxy, using Postman i get the response. However, while making callout from Salesforce, it gives the following error: System....

1
2 3 4 5
10