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

v0.7+ - custom Error classes do not work as expected #546

@michaelbromley

Description

@michaelbromley

Zone.js version: 0.7.2

Setup:

class MyError extends Error {}
let error = new MyError();
console.log(error instanceof MyError);

Expected: logs true
Actual: logs false - error is an instance of Error, rather than MyError when zone.js is loaded in the app.

Demo: https://plnkr.co/edit/kSKVeuhIrMcluK1D9JSl?p=preview
Look in the console to see the erroneous behaviour, and then comment out the script tag including zone.js; and the correct behaviour will be observed in the console.

Replacing the version in the <script> tag with 0.6.26 in the above Plunker demo demonstrates correct behaviour - so this bug was introduced with v0.7+ it seems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions