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.

provide isError and use it in place of instanceof Error #15868

Closed
@graingert

Description

@graingert

I'm submitting a ...

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

Current behavior:

angular sometimes stringifies unhandled rejections, even if they're errors.

Expected / new behavior:

Angular should pass them on to the correct excetion handler

Minimal reproduction of the problem with instructions:
Difficult to reproduce

Angular version: 1.x.y
1.6.3

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 ]
Chrome

Anything else:
Provide angular.isError:

function isError(V) {
  var tagName = Object.prototype.toString.call(V);
  return (
    tagName === '[object Error]' ||
    tagName === '[object Exception]' ||
    V instanceof Error
  );
}

MIT from https://github.com/yefremov/iserror/blob/master/index.js

and use it wherever instanceof Error was used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions