Sha256: 03db47db685b5173ae0078750982272889e9d2278863cedea49cc3cf419398f1

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

module Sandbox
  class Error < StandardError

    def initialize(msg=nil)
      super(msg)
    end

    def message
      out = ["Sandbox error: #{super}"]
      out.concat(backtrace.collect { |bt| "    #{bt}" }) if Sandbox.really_verbose?
      out.join("\n")
    end

  end

  class LoadedSandboxError < Sandbox::Error
    def initialize(msg="You cannot run sandbox from a loaded sandbox environment")
      super(msg)
    end
  end

  class ParseError < Sandbox::Error

    def initialize(reason=nil, args=[])
      msg = if args.is_a?(Array) && args.size > 0
        "#{reason} => #{args.join( ' ' )}"
      elsif args.is_a?(String) && args.length > 0
        "#{reason} => #{args}"
      else
        reason
      end

      super(msg)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-virtualenv-0.5.0 lib/sandbox/errors.rb