Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix error name #26738

Closed
wants to merge 6 commits into from
Closed

lib: fix error name #26738

wants to merge 6 commits into from

Commits on Mar 21, 2019

  1. errors: update error name

    This updates all Node.js errors by removing the `code` being part
    of the `name` property. Instead, the name is just changed once on
    instantiation, the stack is accessed to create the stack as expected
    and then the `name` property is set back to it's original form.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    5b9b538 View commit details
    Browse the repository at this point in the history
  2. lib: refactor Error.captureStackTrace() usage

    When using `Errors.captureStackFrames` the error's stack property
    is set again. This adds a helper function that wraps this functionality
    in a simple API that does not only set the stack including the `code`
    property but it also improves the performance to create the error.
    The helper works for thrown errors and errors returned from wrapped
    functions in case they are Node.js core errors.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    3ed8ec0 View commit details
    Browse the repository at this point in the history
  3. lib: validate Error.captureStackTrace() calls

    This adds a custom eslint rule to verify that
    `Error.captureStackTrace()` is only called if necessary. In most
    cases the helper function should be used instead.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    a833acb View commit details
    Browse the repository at this point in the history
  4. test: remove redundant common.mustCall

    All calls verify the cb is called, thus using `common.mustCall` is
    not required inside of this function.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    c9567ea View commit details
    Browse the repository at this point in the history
  5. n-api: remove code from error name

    This is a first step to align the n-api errors towards errors created
    in JS. The stack still has to be updated to add the error code.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    5c48a01 View commit details
    Browse the repository at this point in the history
  6. assert: improve performance to instantiate errors

    This improves the performance for AssertionError by deactivating
    duplicated stack frame creation.
    BridgeAR committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    e6514c8 View commit details
    Browse the repository at this point in the history