Skip to content

ZoneAwareError reads original stack despite setting __Zone_Error_ZoneJsInternalStackFrames_policy #43240

Open

Description

@vendi95

Which @angular/* package(s) are relevant/releated to the feature request?

No response

Description

Zone.js's ZoneAwareError always stores the original error's stack in the constructor by accessing error.stack no matter what the __Zone_Error_ZoneJsInternalStackFrames_policy is.

const originalStack = (error as any)['originalStack'] = error.stack;

This can lead to performance overhead in V8 when using custom stack traces because the prepareStackTrace method runs uneccesarily when constructing errors even if the error's stack will never be accessed.

In our project we use the source-map-support package that provides source map support for stack traces. This can be a costy operation first time (seconds), which we want to avoid when the error's stack is never accessed.

Proposed solution

If possible only access the original error's stack if it is necessary regarding the __Zone_Error_ZoneJsInternalStackFrames_policy.

Alternatives considered

.

Activity

  1. added this to the needsTriage milestone on Aug 24, 2021
  2. self-assigned this
    on Feb 20, 2022
  3. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Nov 16, 2022
  4. modified the milestones: needsTriage, Backlog on Nov 16, 2022
  5. added a commit that references this issue on Jun 14, 2023
    b580f7b
  6. BraianS commented on May 14, 2024

    @BraianS

    Good morning, any update on this matter? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: zonesIssues related to zone.js

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions