5

I'm using AngularJS version of 1.7.2 and got an exception with this message

Cannot read property 'dataItem' of undefined

and it is not throwing into console / customExceptionHandling Service Because code in AngularJS is below:

catch (e) {
    rejectPromise(promise, e);
    // This error is explicitly marked for being passed to the $exceptionHandler 
    if (e && e.$$passToExceptionHandler === true) {     
        exceptionHandler(e); 
    }
}

that $$passToExceptionHandler is not present in e object and exceptionHandler function is not calling.

Can anyone please explain to me why this is happening?

1
  • The same issue is encountered on angular 1.7.8 Commented Jan 17, 2020 at 17:39

2 Answers 2

3

You might have disabled reporting unhandled rejected promises with this line:

qProvider.errorOnUnhandledRejections(false);

But generally more information about the error source are required to give you better answer.

Sign up to request clarification or add additional context in comments.

2 Comments

You are my savior
Fixed this problem for me.
1

Maybe this will work, set $$passToExceptionHandler to all "Error" instance like:

Error.prototype.$$passToExceptionHandler = true

2 Comments

Confirmed: Adding the suggested line causes the exception to appear in the Chrome dev console.
I like this solution - it seems like a good way to force AngularJS to log all errors to the console, even those that occur within promise chains. I'm a bit nonplussed as to why this isn't the default behaviour...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.