How to resolve the [noerrorobjectavailable] script error.?

1.6K    Asked by ClaudineTippins in Salesforce , Asked on Apr 19, 2023
I have a LWC that is used in different orgs. In one of them, when I dispatch an event like:
this.dispatchEvent( new CustomEvent( 'press' ));
I am getting the [NoErrorObjectAvailable] Script error in that line (as per the Stack trace).

If I comment that line, then the error disappears.

This is the most similar question I have found but I am making no use of event.target so unfortunately it does not help.

What can I be doing wrong?

Answered by David Edmunds

To resolve the [noerrorobjectavailable] script error.-


This error occurred when we were using "cmp or any different value" than what is being passed in the parameter which is "component".
In the second line of code, when we changed "cmp" to "component" - the error got resolved. handleSave : function(component, event, helper) {
var action = cmp.get("c.shareActionPlanTemplates"); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { // alert("From server: " + response.getReturnValue()); console.log(response.getReturnValue()); } else if (state === "INCOMPLETE") { // do something } else if (state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Unknown error"); } } }); $A.enqueueAction(action); },

Your Answer

Interviews

Parent Categories