Sha256: 3a3557650c6e9d46cfe9301455a9424c9a793fea21e93877cc2bef4b17194c64

Contents?: true

Size: 780 Bytes

Versions: 18

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

require_relative "./cli/base"

module NeetoDeploy
  class ExceptionHandler < CLI::Base
    attr_accessor :exception

    def initialize(exception)
      super()
      @exception = exception
    end

    def process
      case exception
      when Thor::RequiredArgumentMissingError
        ui.error(
          "#{exception.message}."\
          ' Please use the "help" command to check all the required options and try again.'
        )
      when Errno::ENOENT
        ui.error(
          "#{exception.message}."\
          " Please check the given path and try again"
        )
      when SystemExit
        ui.error(
          "Process exit with status code 1"
        )
      else
        ui.error(exception.message)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
neetodeploy-1.1.13 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.12 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.11 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.10 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.9 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.8 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.7 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.6 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.4 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.3 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.2 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.1 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.1.0 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.0.10 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.0.9 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.0.8 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.0.7 lib/neeto_deploy/exception_handler.rb
neetodeploy-1.0.6 lib/neeto_deploy/exception_handler.rb