Sha256: 4a1f79e9b15f9035aef3fd3eea974d5f92580db2b7d8896d44df4d14f369508f

Contents?: true

Size: 447 Bytes

Versions: 3

Compression:

Stored size: 447 Bytes

Contents

module UniversaTools

  class MessageException < Exception;
  end

  class CodeException < MessageException
    attr :code

    def initialize code, text = nil
      text ||= code
      @code = code
      super(text)
    end
  end

  class NotFoundException < CodeException
    def initialize object
      super(:file_not_found, "not found: #{object}")
    end
  end

end

def error(message)
  raise UniversaTools::MessageException, message
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
universa_tools-0.1.3 lib/universa_tools/errors.rb
universa_tools-0.1.2 lib/universa_tools/errors.rb
universa_tools-0.1.1 lib/universa_tools/errors.rb