Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http suppressing syntax errors #15887

@SamanthaAdrichem

Description

@SamanthaAdrichem

I'm submitting a ...

  • bug report
  • feature request
  • other (Please do not submit support requests here (see above))

Current behavior:

If a javascript syntax error occurs in a promise.then chain, the promise is now rejected where the error is send as response to the next chain's reject function. This causes our main javascript errorHandler to not trigger, nor to have the error logged in the console. Whilst the code does stop working.

Expected / new behavior:

It used to work in angular 1.5.5, it no longer does in 1.6.2 -> 1.6.4. Syntax error's / programming errors should not just be caught in a promise and then reject the promise. They should always be fired as the syntax error they are.

Minimal reproduction of the problem with instructions:

angular 1.5.5 working:
https://plnkr.co/edit/fi32lCTkH7U8zgYQQWLN

angular 1.6.3 no longer working (1.6.4 isn't CDN available yet)
https://plnkr.co/edit/zoYtfbCfElr2MKmMP7RG

Setup angular version 1.6.4, start a $http call to an API with a JSON response, use the following successFunction

function processResponse( response ) {
    response.nonExistingVar.subVariable = 'test'; 
}

It should result in : Uncaught TypeError: Cannot set property 'subVariable' of undefined, instead your code is silent.

Add a second .then with the following reject function (or a catch);

function errorFunction( response ) {
    console.log( response );
}

Angular version: 1.6.4

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Alteast in Chrome 57.0.2987.98 (64-bit), but i think in all browsers

Anything else:

It seems to relate to this issue: #15855

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions