Skip to content

Multiple inaccuracies in API documentation #5382

@AliMahmoudDev

Description

@AliMahmoudDev

Found several documentation inaccuracies while reading through the API docs:

GettingStarted.md

  • Error handling example uses errors.ClassName.code (static property) but code is an instance property only
    • errors.ConnectTimeoutError.code evaluates to undefined since .code is set in the constructor, not as a static property
    • The switch/case branches never match — should use string literals like "UND_ERR_CONNECT_TIMEOUT" instead

RetryHandler.md

  • Constructor signature documents 3 params but code takes 2: new RetryHandler(dispatchOptions, retryHandlers, [retryOptions]) should be new RetryHandler(opts, { dispatch, handler })
  • Default methods missing TRACE: doc says ["GET", "PUT", "HEAD", "OPTIONS", "DELETE"] but source has ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"]
  • Default errorCodes missing EHOSTUNREACH and EPIPE: doc lists 7 codes, source has 9

RetryAgent.md

  • Return type says ProxyAgent but should be RetryAgent
  • Same methods and errorCodes defaults issues as RetryHandler.md

BalancedPool.md

  • Property heading says Pool.stats but should be BalancedPool.stats

Errors.md

  • Socks5ProxyError code says UND_ERR_SOCKS5* (with wildcard) but the actual default is UND_ERR_SOCKS5 (no wildcard)

MockAgent.md

  • Example calls clearAllCallHistory() but the actual method name is clearCallHistory() (no "All")

Dispatcher.md

  • Broken link: Dispatch.md should be Dispatcher.md
  • onBodySent callback not documented in the DispatchHandler interface (it is validated in lib/core/util.js)

Happy to open a PR fixing these.

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