Class: Dependabot::Opentofu::FileUpdaterErrorHandler

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/opentofu/file_updater.rb

Constant Summary collapse

RESOLVE_ERROR =
/Could not retrieve providers for locking/
CONSTRAINTS_ERROR =
/no available releases match/

Instance Method Summary collapse

Instance Method Details

#handle_helper_subprocess_failed_error(error) ⇒ Object

Raises:

  • (Dependabot::DependencyFileNotResolvable)


495
496
497
498
499
500
501
502
503
504
# File 'lib/dependabot/opentofu/file_updater.rb', line 495

def handle_helper_subprocess_failed_error(error)
  unless sanitize_message(error.message).match?(RESOLVE_ERROR) &&
         sanitize_message(error.message).match?(CONSTRAINTS_ERROR)
    return
  end

  raise Dependabot::DependencyFileNotResolvable,
        "Error while updating lockfile, " \
        "no matching constraints found."
end

#sanitize_message(message) ⇒ Object



507
508
509
# File 'lib/dependabot/opentofu/file_updater.rb', line 507

def sanitize_message(message)
  message.gsub(/\e\[[\d;]*[A-Za-z]/, "").delete("\n").delete("").squeeze(" ")
end