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

Failed to retrieve member "captureStackTrace" of [CustomErrorClass] for inheritance analysis #1541

Closed
zajrik opened this issue Mar 18, 2021 · 4 comments
Labels
bug Functionality does not match expectation

Comments

@zajrik
Copy link

zajrik commented Mar 18, 2021

Search terms

failed to retrieve member, inheritance analysis

Expected Behavior

I expect to not encounter this message as I did not encounter it previously on 0.20.30 with the same code.

Actual Behavior

I receive the following warning output when building my docs:

Warning: Failed to retrieve member "captureStackTrace" of "ErrorHandlerError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "ErrorHandlerError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "prepareStackTrace" of "ErrorHandlerError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "stackTraceLimit" of "ErrorHandlerError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "CommandArgumentError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "CommandArgumentError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "prepareStackTrace" of "CommandArgumentError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "stackTraceLimit" of "CommandArgumentError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "CommandDispatchError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "CommandDispatchError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "prepareStackTrace" of "CommandDispatchError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "stackTraceLimit" of "CommandDispatchError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "ArgumentParseError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "captureStackTrace" of "ArgumentParseError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "prepareStackTrace" of "ArgumentParseError" for inheritance analysis. Please report a bug.
Warning: Failed to retrieve member "stackTraceLimit" of "ArgumentParseError" for inheritance analysis. Please report a bug.

I was not having this message pop up on 0.20.30 but it triggered a failure in my docs build test action on the Dependabot PR to update to 0.20.32, even though it's just a warning. The action looks for the word "error" in the output because TypeDoc doesn't exit with an error code or anything, so it was a false positive, but I'm reporting the bug since the message told me to do so, haha. Weirdly, this does not happen in another of my modules for this org that also has custom error classes that inherit from Error, so I'm a little perplexed.

Steps to reproduce the bug

  • git clone https://github.com/discord-samba/command.git
  • npm install
  • Edit scripts/typedoc-runner.js and replace the theme value with 'default' to confirm the issue is present on the default theme without any of my modifications
  • run node scripts/typedoc-runner.js
    • Note: This will create a docs directory alongside the cloned repo directory as opposed to inside of it
  • Observe warning output

Due to the fact that I can't reproduce the issue on the other module I have that has custom error classes, I didn't really want to jump through the hoops to produce a minimal reproducible sample repo, so I apologize for the extra needed effort to see the issue for yourself.

Environment

  • Typedoc version: 0.20.32
  • TypeScript version: 4.2.3
  • Node.js version: 14.15.3
  • OS: Ubuntu 20.04.2 LTS on Windows 10 x86_64
@zajrik zajrik added the bug Functionality does not match expectation label Mar 18, 2021
@zajrik zajrik changed the title Failed to retrieve member "captureStackTrace" of "ErrorHandlerError" for inheritance analysis Failed to retrieve member "captureStackTrace" of [CustomErrorClass] for inheritance analysis Mar 18, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 21, 2021

TypeDoc doesn't exit with an error code or anything

But... we do?

typedoc/bin/typedoc

Lines 6 to 13 in 9a627d8

const ExitCodes = {
Ok: 0,
OptionError: 1,
NoEntryPoints: 2,
CompileError: 3,
OutputError: 4,
ExceptionThrown: 5,
};

There was a bug in early 0.20 that broke this, but it's been fixed for a while now...

Warning: Failed to retrieve member "captureStackTrace" of "ErrorHandlerError" for inheritance analysis. Please report a bug.

You see this in some projects but not all because this property is added to Error in @types/node, so if those aren't installed, it won't be picked up. This should be converted as a static member, but TypeDoc doesn't properly convert these members as static, so we try to find the member on the instance side and fail... annoying to fix it unfortunately. Going to need to think about this one...

@zajrik
Copy link
Author

zajrik commented Mar 21, 2021

TypeDoc doesn't exit with an error code or anything

But... we do?

typedoc/bin/typedoc

Lines 6 to 13 in 9a627d8

const ExitCodes = {
Ok: 0,
OptionError: 1,
NoEntryPoints: 2,
CompileError: 3,
OutputError: 4,
ExceptionThrown: 5,
};

There was a bug in early 0.20 that broke this, but it's been fixed for a while now...

I encountered a situation where merging a dependabot PR broke my docs build despite having a docs build test action (which I wrote after a different dependabot PR broke my docs builds). I reviewed the action run to find that the docs build had errored out but the action did not mark that step as failed (I would assume because of no exit code), so the run completed successfully. That led to me adding a grep for Error and an extra step that checks the result of that to determine whether or not there was an error building the docs and error out the test. It's definitely possible that this occurred during the period of time that bug existed and I was just unaware of it.

You see this in some projects but not all because this property is added to Error in @types/node, so if those aren't installed, it won't be picked up. This should be converted as a static member, but TypeDoc doesn't properly convert these members as static, so we try to find the member on the instance side and fail... annoying to fix it unfortunately. Going to need to think about this one...

I do have @types/node installed for sure, no question about that. Thank you for looking into this. I hope it doesn't give you too much trouble.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 22, 2021

Turns out fixing this just requires adding a flag... which is kind of annoying, but very minimal code changes.

@zajrik
Copy link
Author

zajrik commented Mar 22, 2021

Awesome. Good work :o)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants