Sha256: ae6046218288b75387bdd74239194726d0458da8fcd779abc370c30bb301f32a

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

module Dirwatch
  module UserFriendlyError
    def user_friendly_message
      message
    end
  end

  class FileNotFoundError < IOError
    include UserFriendlyError

    attr_reader :filename
    def initialize filename, msg = nil
      super msg || "Could not find the file #{filename.inspect}"
      @filename = filename
    end
  end

  class FileEmptyError < IOError
    include UserFriendlyError

    attr_reader :filename
    def initialize filename, msg = nil
      super msg || "The file #{filename.inspect} is empty"
      @filename = filename
    end
  end

  class InvalidValueError < StandardError
    include UserFriendlyError
  end

  class TemplateNotFoundError < StandardError
    attr_reader :template
    def initialize template, msg = nil
      super msg || "Could not find the template #{template}"
      @template = template
    end
  end

  class OsNotSupportedError < StandardError
    attr_reader :os, :available
    def initialize os, available, msg = nil
      super msg || "The operating system #{os} is not supported. Only #{available.join ', '}"
      @os = os
      @available = available
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dirwatch-0.0.9 lib/dirwatch/errors.rb
dirwatch-0.0.8 lib/dirwatch/errors.rb
dirwatch-0.0.7 lib/dirwatch/errors.rb
dirwatch-0.0.6 lib/dirwatch/errors.rb
dirwatch-0.0.5 lib/dirwatch/errors.rb
dirwatch-0.0.4 lib/dirwatch/errors.rb
dirwatch-0.0.3 lib/dirwatch/errors.rb
dirwatch-0.0.2 lib/dirwatch/errors.rb