Class: Dependabot::NpmAndYarn::PnpmErrorHandler
- Inherits:
-
Object
- Object
- Dependabot::NpmAndYarn::PnpmErrorHandler
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb
Overview
rubocop:enable Metrics/ClassLength
Constant Summary collapse
- ECONNRESET_ERROR =
remote connection closed
/ECONNRESET/- SOCKET_HANG_UP =
socket hang up error code
/socket hang up/- ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC =
ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC error
/ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC/- DUPLICATE_PACKAGE =
duplicate package error code
/Found duplicates/- ERR_PNPM_NO_VERSIONS =
/ERR_PNPM_NO_VERSIONS/
Instance Method Summary collapse
- #handle_pnpm_error(error) ⇒ Object
-
#initialize(dependencies:, dependency_files:) ⇒ PnpmErrorHandler
constructor
A new instance of PnpmErrorHandler.
Constructor Details
#initialize(dependencies:, dependency_files:) ⇒ PnpmErrorHandler
Returns a new instance of PnpmErrorHandler.
517 518 519 520 |
# File 'lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb', line 517 def initialize(dependencies:, dependency_files:) @dependencies = dependencies @dependency_files = dependency_files end |
Instance Method Details
#handle_pnpm_error(error) ⇒ Object
534 535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb', line 534 def handle_pnpm_error(error) if error..match?(DUPLICATE_PACKAGE) || error..match?(ERR_PNPM_NO_VERSIONS) || error..match?(ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC) raise DependencyFileNotResolvable, "Error resolving dependency" end ## Clean error message from ANSI escape codes return unless error..match?(ECONNRESET_ERROR) || error..match?(SOCKET_HANG_UP) raise InconsistentRegistryResponse, "Inconsistent registry response while resolving dependency" end |