Sha256: 4f6b886d8f6b7bb30306d04474a93f5b54e03735a33ddc694f844fbc37406aad

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

# encoding: utf-8
module CSD
  # In this module we will keep all types of errors in a readable hierarchy
  #
  module Error
    
    # All Exceptions raised by CSD must be children of this class. 
    #
    class CSDError < StandardError
      def self.status_code(code = nil)
        return @code unless code
        @code = code
      end
    
      def status_code
        self.class.status_code
      end
    end
    
    # Errors in this module are related to command-line options
    #
    module Argument
      class NoApplication < CSDError; status_code(11); end
      class NoAction < CSDError; status_code(12); end
    end
    
    module Application
      class OptionsSyntax < CSDError; status_code(200); end
    end
  
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csd-0.1.5 lib/csd/error.rb
csd-0.1.4 lib/csd/error.rb
csd-0.1.3 lib/csd/error.rb