Skip to content

Commit

Permalink
Pass exception message directly to peer dependency error handler (#7178)
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored Apr 26, 2023
1 parent fb4cf4a commit 92fcfeb
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,22 +331,22 @@ def fetch_peer_dependency_errors(version:)
[]
end

def handle_peer_dependency_errors(error)
def handle_peer_dependency_errors(message)
errors = []
if error.message.match?(NPM6_PEER_DEP_ERROR_REGEX)
error.message.scan(NPM6_PEER_DEP_ERROR_REGEX) do
if message.match?(NPM6_PEER_DEP_ERROR_REGEX)
message.scan(NPM6_PEER_DEP_ERROR_REGEX) do
errors << Regexp.last_match.named_captures
end
elsif error.message.match?(NPM8_PEER_DEP_ERROR_REGEX)
error.message.scan(NPM8_PEER_DEP_ERROR_REGEX) do
elsif message.match?(NPM8_PEER_DEP_ERROR_REGEX)
message.scan(NPM8_PEER_DEP_ERROR_REGEX) do
errors << Regexp.last_match.named_captures
end
elsif error.message.match?(YARN_PEER_DEP_ERROR_REGEX)
error.message.scan(YARN_PEER_DEP_ERROR_REGEX) do
elsif message.match?(YARN_PEER_DEP_ERROR_REGEX)
message.scan(YARN_PEER_DEP_ERROR_REGEX) do
errors << Regexp.last_match.named_captures
end
elsif error.message.match?(YARN_BERRY_PEER_DEP_ERROR_REGEX)
error.message.scan(YARN_BERRY_PEER_DEP_ERROR_REGEX) do
elsif message.match?(YARN_BERRY_PEER_DEP_ERROR_REGEX)
message.scan(YARN_BERRY_PEER_DEP_ERROR_REGEX) do
errors << Regexp.last_match.named_captures
end
else
Expand Down Expand Up @@ -495,7 +495,7 @@ def run_checker(path:, version:)

run_npm_checker(path: path, version: version)
rescue SharedHelpers::HelperSubprocessFailed => e
handle_peer_dependency_errors(e)
handle_peer_dependency_errors(e.message)
end

def run_yarn_checker(path:, version:, lockfile:)
Expand Down

0 comments on commit 92fcfeb

Please sign in to comment.