Module: Bundler::FriendlyErrors (Ruby 2.7.3)
Description: Module : Bundler::FriendlyErrors - Ruby 2.7.3

### Home Classes Methods

### In Files

- bundler/friendly_errors.rb

### Methods

- #exit_status
- #issues_url
- #log_error
- #request_issue_report_for

### Class/Module Index

Quicksearch

- AmbiguousCommandError
- AmbiguousTaskError
- Bundler
- Bundler::APIResponseMismatchError
- Bundler::BuildMetadata
- Bundler::BundlerError
- Bundler::CLI
- Bundler::CLI::Add
- Bundler::CLI::Binstubs
- Bundler::CLI::Cache
- Bundler::CLI::Check
- Bundler::CLI::Clean
- Bundler::CLI::Common
- Bundler::CLI::Config
- Bundler::CLI::Config::Base
- Bundler::CLI::Console
- Bundler::CLI::Doctor
- Bundler::CLI::Exec
- Bundler::CLI::Gem
- Bundler::CLI::Info
- Bundler::CLI::Init
- Bundler::CLI::Inject
- Bundler::CLI::Install
- Bundler::CLI::Issue
- Bundler::CLI::List
- Bundler::CLI::Lock
- Bundler::CLI::Open
- Bundler::CLI::Outdated
- Bundler::CLI::Package
- Bundler::CLI::Platform
- Bundler::CLI::Plugin
- Bundler::CLI::Pristine
- Bundler::CLI::Remove
- Bundler::CLI::Show
- Bundler::CLI::Update
- Bundler::CLI::Viz
- Bundler::CompactIndexClient
- Bundler::CompactIndexClient::Cache
- Bundler::CompactIndexClient::Error
- Bundler::CompactIndexClient::Updater
- Bundler::CompactIndexClient::Updater::MisMatchedChecksumError
- Bundler::ConnectionPool
- Bundler::ConnectionPool::Error
- Bundler::ConnectionPool::PoolShuttingDownError
- Bundler::ConnectionPool::TimedStack
- Bundler::ConnectionPool::Wrapper
- Bundler::CurrentRuby
- Bundler::CyclicDependencyError
- Bundler::Definition
- Bundler::DepProxy
- Bundler::Dependency
- Bundler::Deployment
- Bundler::Deprecate
- Bundler::DeprecatedError
- Bundler::Dsl
- Bundler::Dsl::DSLError
- Bundler::EndpointSpecification
- Bundler::Env
- Bundler::EnvironmentPreserver
- Bundler::FeatureFlag
- Bundler::Fetcher
- Bundler::Fetcher::AuthenticationRequiredError
- Bundler::Fetcher::BadAuthenticationError
- Bundler::Fetcher::Base
- Bundler::Fetcher::CertificateFailureError
- Bundler::Fetcher::CompactIndex
- Bundler::Fetcher::Dependency
- Bundler::Fetcher::Downloader
- Bundler::Fetcher::FallbackError
- Bundler::Fetcher::Index
- Bundler::Fetcher::NetworkDownError
- Bundler::Fetcher::SSLError
- Bundler::Fetcher::TooManyRequestsError
- Bundler::FileUtils
- Bundler::FileUtils::DryRun
- Bundler::FileUtils::NoWrite
- Bundler::FileUtils::StreamUtils_
- Bundler::FileUtils::Verbose
- Bundler::FriendlyErrors
- Bundler::GemHelper
- Bundler::GemHelpers
- Bundler::GemHelpers::PlatformMatch
- Bundler::GemInstaller
- Bundler::GemNotFound
- Bundler::GemRemoteFetcher
- Bundler::GemRequireError
- Bundler::GemVersionPromoter
- Bundler::Gemdeps
- Bundler::GemfileError
- Bundler::GemfileEvalError
- Bundler::GemfileLockNotFound
- Bundler::GemfileNotFound
- Bundler::GemspecError
- Bundler::GenericSystemCallError
- Bundler::GitError
- Bundler::Graph
- Bundler::Graph::GraphVizClient
- Bundler::HTTPError
- Bundler::Index
- Bundler::Injector
- Bundler::InstallError
- Bundler::InstallHookError
- Bundler::Installer
- Bundler::InvalidOption
- Bundler::LazySpecification
- Bundler::LazySpecification::Identifier
- Bundler::LockfileError
- Bundler::LockfileGenerator
- Bundler::LockfileParser
- Bundler::MarshalError
- Bundler::MatchPlatform
- Bundler::MirrorSockets
- Bundler::Molinillo
- Bundler::Molinillo::CircularDependencyError
- Bundler::Molinillo::Compatibility
- Bundler::Molinillo::Delegates
- Bundler::Molinillo::Delegates::ResolutionState
- Bundler::Molinillo::Delegates::SpecificationProvider
- Bundler::Molinillo::DependencyGraph
- Bundler::Molinillo::DependencyGraph::Action
- Bundler::Molinillo::DependencyGraph::AddEdgeNoCircular
- Bundler::Molinillo::DependencyGraph::DeleteEdge
- Bundler::Molinillo::DependencyGraph::DetachVertexNamed
- Bundler::Molinillo::DependencyGraph::Log
- Bundler::Molinillo::DependencyGraph::Tag
- Bundler::Molinillo::DependencyGraph::Vertex
- Bundler::Molinillo::DependencyState
- Bundler::Molinillo::NoSuchDependencyError
- Bundler::Molinillo::PossibilityState
- Bundler::Molinillo::ResolutionState
- Bundler::Molinillo::Resolver
- Bundler::Molinillo::Resolver::Resolution
- Bundler::Molinillo::Resolver::Resolution::Conflict
- Bundler::Molinillo::Resolver::Resolution::PossibilitySet
- Bundler::Molinillo::Resolver::Resolution::UnwindDetails
- Bundler::Molinillo::ResolverError
- Bundler::Molinillo::SpecificationProvider
- Bundler::Molinillo::UI
- Bundler::Molinillo::VersionConflict
- Bundler::NoSpaceOnDeviceError
- Bundler::OperationNotSupportedError
- Bundler::ParallelInstaller
- Bundler::ParallelInstaller::SpecInstallation
- Bundler::PathError
- Bundler::PermissionError
- Bundler::Persistent
- Bundler::Persistent::Net
- Bundler::Persistent::Net::HTTP
- Bundler::Persistent::Net::HTTP::Persistent
- Bundler::Persistent::Net::HTTP::Persistent::Error
- Bundler::PersistentHTTP
- Bundler::Plugin
- Bundler::Plugin::API
- Bundler::Plugin::API::Source
- Bundler::Plugin::DSL
- Bundler::Plugin::DSL::PluginGemfileError
- Bundler::Plugin::Events
- Bundler::Plugin::Index
- Bundler::Plugin::Index::CommandConflict
- Bundler::Plugin::Index::SourceConflict
- Bundler::Plugin::Installer
- Bundler::Plugin::Installer::Git
- Bundler::Plugin::Installer::Rubygems
- Bundler::Plugin::MalformattedPlugin
- Bundler::Plugin::SourceList
- Bundler::Plugin::UndefinedCommandError
- Bundler::Plugin::UnknownSourceError
- Bundler::PluginError
- Bundler::ProcessLock
- Bundler::ProductionError
- Bundler::RemoteSpecification
- Bundler::Resolver
- Bundler::Resolver::SpecGroup
- Bundler::Retry
- Bundler::RubyDsl
- Bundler::RubyGemsGemInstaller
- Bundler::RubyVersion
- Bundler::RubyVersionMismatch
- Bundler::RubygemsIntegration
- Bundler::RubygemsIntegration::Gem
- Bundler::Runtime
- Bundler::SecurityError
- Bundler::Settings
- Bundler::Settings::Mirror
- Bundler::Settings::MirrorConfig
- Bundler::Settings::Mirrors
- Bundler::Settings::TCPSocketProbe
- Bundler::Settings::Validator
- Bundler::Settings::Validator::Rule
- Bundler::SharedHelpers
- Bundler::SimilarityDetector
- Bundler::SocketAddress
- Bundler::Source
- Bundler::Source::Gemspec
- Bundler::Source::Git
- Bundler::Source::Git::GitCommandError
- Bundler::Source::Git::GitNotAllowedError
- Bundler::Source::Git::GitNotInstalledError
- Bundler::Source::Git::GitProxy
- Bundler::Source::Git::MissingGitRevisionError
- Bundler::Source::Metadata
- Bundler::Source::Path
- Bundler::Source::Path::Installer
- Bundler::Source::Rubygems
- Bundler::Source::Rubygems::Remote
- Bundler::SourceList
- Bundler::SpecSet
- Bundler::Standalone
- Bundler::StubSpecification
- Bundler::SudoNotPermittedError
- Bundler::TemporaryResourceError
- Bundler::Thor::Actions
- Bundler::Thor::Actions::CapturableERB
- Bundler::Thor::Actions::ClassMethods
- Bundler::Thor::Base
- Bundler::Thor::Base::ClassMethods
- Bundler::Thor::Command
- Bundler::Thor::CoreExt
- Bundler::Thor::CoreExt::OrderedHash
- Bundler::Thor::DynamicCommand
- Bundler::Thor::DynamicTask
- Bundler::Thor::Group
- Bundler::Thor::HiddenCommand
- Bundler::Thor::HiddenTask
- Bundler::Thor::Invocation
- Bundler::Thor::Invocation::ClassMethods
- Bundler::Thor::LineEditor
- Bundler::Thor::LineEditor::Basic
- Bundler::Thor::LineEditor::Readline
- Bundler::Thor::LineEditor::Readline::PathCompletion
- Bundler::Thor::NestedContext
- Bundler::Thor::RakeCompat
- Bundler::Thor::Shell
- Bundler::Thor::Shell::Basic
- Bundler::Thor::Shell::Color
- Bundler::Thor::Shell::HTML
- Bundler::Thor::Task
- Bundler::Thor::Util
- Bundler::ThreadCreationError
- Bundler::UI
- Bundler::UI::RGProxy
- Bundler::UI::Shell
- Bundler::UI::Silent
- Bundler::URI
- Bundler::URI::BadURIError
- Bundler::URI::Error
- Bundler::URI::Escape
- Bundler::URI::FTP
- Bundler::URI::File
- Bundler::URI::Generic
- Bundler::URI::HTTP
- Bundler::URI::HTTPS
- Bundler::URI::InvalidComponentError
- Bundler::URI::InvalidURIError
- Bundler::URI::LDAP
- Bundler::URI::LDAPS
- Bundler::URI::MailTo
- Bundler::URI::Parser
- Bundler::URI::REGEXP
- Bundler::URI::RFC2396_Parser
- Bundler::URI::RFC2396_REGEXP
- Bundler::URI::RFC2396_REGEXP::PATTERN
- Bundler::URICredentialsFilter
- Bundler::VersionConflict
- Bundler::VersionRanges
- Bundler::VersionRanges::ReqR
- Bundler::VirtualProtocolError
- Bundler::Worker
- Bundler::Worker::WrappedException
- Bundler::YAMLSerializer
- Bundler::YamlSyntaxError
- Error
- Gem
- Gem::Dependency
- Gem::Platform
- Gem::Specification
- InvocationError
- Kernel
- MalformattedArgumentError
- Object
- RequiredArgumentMissingError
- UndefinedCommandError
- UndefinedCommandError::SpellChecker
- UndefinedTaskError
- UnknownArgumentError
- UnknownArgumentError::SpellChecker

No matching classes.

# Bundler::FriendlyErrors

### Public Instance Methods

exit_status(error) click to toggle source

                   # File bundler/friendly_errors.rb, line 50
    def exit_status(error)
      case error
      when BundlerError then error.status_code
      when Thor::Error then 15
      when SystemExit then error.status
      else 1
      end
    end

issues_url(exception) click to toggle source

                   # File bundler/friendly_errors.rb, line 113
    def issues_url(exception)
      message = exception.message.lines.first.tr(":", " ").chomp
      message = message.split("-").first if exception.is_a?(Errno)
      require "cgi"
      "https://github.com/bundler/bundler/search?q=" \
        "#{CGI.escape(message)}&type=Issues"
    end

log_error(error) click to toggle source

                   # File bundler/friendly_errors.rb, line 9
        def log_error(error)
          case error
          when YamlSyntaxError
            Bundler.ui.error error.message
            Bundler.ui.trace error.orig_exception
          when Dsl::DSLError, GemspecError
            Bundler.ui.error error.message
          when GemRequireError
            Bundler.ui.error error.message
            Bundler.ui.trace error.orig_exception
          when BundlerError
            Bundler.ui.error error.message, :wrap => true
            Bundler.ui.trace error
          when Thor::Error
            Bundler.ui.error error.message
          when LoadError
            raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
            Bundler.ui.error "\nCould not load OpenSSL."
            Bundler.ui.warn <<-WARN, :wrap => true
              You must recompile Ruby with OpenSSL support or change the sources in your \
              Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
              using RVM are available at https://rvm.io/packages/openssl.
            WARN
            Bundler.ui.trace error
          when Interrupt
            Bundler.ui.error "\nQuitting..."
            Bundler.ui.trace error
          when Gem::InvalidSpecificationException
            Bundler.ui.error error.message, :wrap => true
          when SystemExit
          when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
            Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
              "You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, " \
              "especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). " \
              "Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
          else request_issue_report_for(error)
          end
        rescue StandardError
          raise error
        end

request_issue_report_for(e) click to toggle source

                   # File bundler/friendly_errors.rb, line 59
        def request_issue_report_for(e)
          Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
            --- ERROR REPORT TEMPLATE -------------------------------------------------------
            # Error Report

            ## Questions

            Please fill out answers to these questions, it'll help us figure out
            why things are going wrong.

            - **What did you do?**

              I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`

            - **What did you expect to happen?**

              I expected Bundler to...

            - **What happened instead?**

              Instead, what happened was...

            - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**

              I tried...

            - **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**

              ...

            ## Backtrace

            ```
            #{e.class}: #{e.message}
              #{e.backtrace && e.backtrace.join("\n          ").chomp}
            ```

            #{Bundler::Env.report}
            --- TEMPLATE END ----------------------------------------------------------------

          EOS

          Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."

          Bundler.ui.warn <<-EOS.gsub(/^ {8}/, "")

            First, try this link to see if there are any existing issue reports for this error:
            #{issues_url(e)}

            If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
            https://github.com/bundler/bundler/issues/new
          EOS
        end