Sha256: c0811bbc25c5131a5dde3f079c0edf071bda05858ff95b8aefc48383846be75b

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

#
# h2. lib/imw/utils/error -- errors
#
# == About
#
# Error objects for IMW.
#
# Author::    (Philip flip Kromer, Dhruv Bansal) for Infinite Monkeywrench Project (mailto:coders@infochimps.org)
# Copyright:: Copyright (c) 2008 infochimps.org
# License::   GPL 3.0
# Website::   http://infinitemonkeywrench.org/
#

module IMW

  # A generic error class.
  class Error < StandardError
  end

  class TypeError < TypeError
  end

  class ArgumentError < ArgumentError
  end

  class NotImplementedError < NotImplementedError
  end

  class ParseError < Error
  end

  # An error meant to be used when a system call goes awry.  It will
  # report exit status and the process id of the offending call.
  class SystemCallError < IMW::Error

    def initialize(message)
      @message = message
    end

    def display
      "(error code: #{$?.exitstatus}, pid: #{$?.pid}) #{@message}"
    end

    def to_s
      "(error code: #{$?.exitstatus}, pid: #{$?.pid}) #{@message}"
    end

  end

  # A error for improperly specified, inappropriate, or broken paths.
  class PathError < IMW::Error
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imw-0.1.1 lib/imw/utils/error.rb
imw-0.1.0 lib/imw/utils/error.rb