diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-29 07:54:38 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-29 07:54:38 +0000 |
commit | 919f456de88e9e1011db8f6e4e484e1b25e77af4 () | |
tree | e367d6d1ba65d30139ae43891b52edfe71be8fca /lib | |
parent | 6a738f22656ffe247bcd02cf354c12a5370818ec (diff) |
* exception message clean-up by Ian Macdonald <[email protected]>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/cgi.rb | 2 | ||||
-rw-r--r-- | lib/csv.rb | 8 | ||||
-rw-r--r-- | lib/delegate.rb | 3 | ||||
-rw-r--r-- | lib/generator.rb | 4 | ||||
-rw-r--r-- | lib/net/http.rb | 8 | ||||
-rw-r--r-- | lib/net/https.rb | 2 | ||||
-rw-r--r-- | lib/net/imap.rb | 2 | ||||
-rw-r--r-- | lib/net/pop.rb | 4 | ||||
-rw-r--r-- | lib/net/smtp.rb | 6 | ||||
-rw-r--r-- | lib/open-uri.rb | 2 | ||||
-rw-r--r-- | lib/ostruct.rb | 2 | ||||
-rw-r--r-- | lib/rational.rb | 4 | ||||
-rw-r--r-- | lib/resolv.rb | 12 | ||||
-rw-r--r-- | lib/singleton.rb | 20 | ||||
-rw-r--r-- | lib/tempfile.rb | 2 | ||||
-rw-r--r-- | lib/wsdl/operation.rb | 2 | ||||
-rw-r--r-- | lib/xmlrpc/parser.rb | 2 |
17 files changed, 44 insertions, 41 deletions
@@ -30,7 +30,7 @@ # See http://www.w3.org/CGI/ for more information on the CGI # protocol. -raise "Please, use ruby1.5.4 or later." if RUBY_VERSION < "1.5.4" require 'English' @@ -557,7 +557,7 @@ class CSV private def initialize(dev) - raise RuntimeError.new('do not instanciate this class directly') end def get_row(row) @@ -709,7 +709,7 @@ class CSV private def initialize(dev) - raise RuntimeError.new('do not instanciate this class directly') end def terminate @@ -801,7 +801,7 @@ class CSV # end # end # - class StreamBuf # pure virtual. (do not instanciate it directly) # get a char or a partial string from the stream. # idx: index of a string to specify a start point of a string to get. @@ -893,7 +893,7 @@ class CSV return idx_is_eos?(0) end - # WARN: Do not instanciate this class directly. Define your own class # which derives this class and define 'read' instance method. def initialize @buf_list = [] @@ -111,6 +111,9 @@ def DelegateClass(superclass) def __getobj__ @_dc_obj end return klass; end @@ -125,7 +125,7 @@ class Generator # Returns the element at the current position and moves forward. def next() if end? - raise EOFError, "no more element is supplied" end if @cont_next = callcc { |c| c } @@ -140,7 +140,7 @@ class Generator # Returns the element at the current position. def current() if @queue.empty? - raise EOFError, "no more element is supplied" end @queue.first @@ -121,7 +121,7 @@ module Net # :nodoc: # # def fetch( uri_str, limit = 10 ) # # You should choose better exception. - # raise ArgumentError, 'http redirect too deep' if limit == 0 # # response = Net::HTTP.get_response(URI.parse(uri_str)) # case response @@ -480,7 +480,7 @@ module Net # :nodoc: # Finishes HTTP session and closes TCP connection. # Raises IOError if not started. def finish - raise IOError, 'HTTP session not started yet' unless started? do_finish end @@ -2058,11 +2058,11 @@ e @header.each_key(&block) end def stream_check - raise IOError, 'try to read body out of block' if @socket.closed? end def procdest(dest, block) - raise ArgumentError, 'both of arg and block are given for HTTP method' \ if dest and block if block ReadAdapter.new(block) @@ -123,7 +123,7 @@ module Net # a Net::HTTP object raises IOError. def use_ssl=(flag) flag = (flag ? true : false) - raise IOError, "use_ssl value changed but session already started" \ if started? and @use_ssl != flag if flag and not @ssl_context @ssl_context = OpenSSL::SSL::SSLContext.new @@ -859,7 +859,7 @@ module Net # :nodoc: # firewall. # Errno::ETIMEDOUT:: connection timed out (possibly due to packets # being dropped by an intervening firewall). - # Errno::NETUNREACH:: there is no route to that network. # SocketError:: hostname not known or other socket error. # Net::IMAP::ByeResponseError:: we connected to the host, but they # immediately said goodbye to us. @@ -293,7 +293,7 @@ module Net # This method must not be called while POP3 session is opened. # This method raises POPAuthenticationError if authentication fails. def auth_only(account, password) - raise IOError, 'opening already opened POP session' if started? start(account, password) { ; } @@ -449,7 +449,7 @@ module Net # Finishes a POP3 session and closes TCP connection. def finish - raise IOError, 'POP session not started yet' unless started? do_finish end @@ -373,7 +373,7 @@ module Net # :nodoc: # Finishes the SMTP session and closes TCP connection. # Raises IOError if not started. def finish - raise IOError, 'not started yet' unless started? do_finish end @@ -474,7 +474,7 @@ module Net # :nodoc: def send0( from_addr, to_addrs ) raise IOError, 'closed session' unless @socket - raise ArgumentError, 'mail destination does not given' if to_addrs.empty? if $SAFE > 0 raise SecurityError, 'tainted from_addr' if from_addr.tainted? to_addrs.each do |to| @@ -501,7 +501,7 @@ module Net # :nodoc: private def check_auth_args( user, secret, authtype ) - raise ArgumentError, 'both of user and secret are required'\ unless user and secret auth_method = "auth_#{authtype || 'cram_md5'}" raise ArgumentError, "wrong auth type #{authtype}"\ @@ -501,7 +501,7 @@ module URI if proxy_uri proxy_uri = URI.parse(proxy_uri) unless URI::HTTP === proxy_uri - raise "Non-http proxy URI: #{proxy_uri}" end name = 'no_proxy' if no_proxy = ENV[name] || ENV[name.upcase] @@ -63,7 +63,7 @@ class OpenStruct len = args.length if mname =~ /=$/ if len != 1 - raise ArgumentError, "wrong # of arguments (#{len} for 1)", caller(1) end if self.frozen? raise TypeError, "can't modify frozen #{self.class}", caller(1) @@ -48,7 +48,7 @@ class Rational < Numeric @RCS_ID='-$Id: rational.rb,v 1.7 1999/08/24 12:49:28 keiju Exp keiju $-' def Rational.reduce(num, den = 1) - raise ZeroDivisionError, "denominator is 0" if den == 0 if den < 0 num = -num @@ -135,7 +135,7 @@ class Rational < Numeric den = @denominator * a.numerator Rational(num, den) elsif a.kind_of?(Integer) - raise ZeroDivisionError, "divided by 0" if a == 0 self / Rational.new!(a, 1) elsif a.kind_of?(Float) Float(self) / a @@ -1157,9 +1157,9 @@ class Resolv @limit = @index + len d = yield(len) if @index < @limit - raise DecodeError.new("junk exist") elsif @limit < @index - raise DecodeError.new("limit exceed") end @limit = save_limit return d @@ -1185,7 +1185,7 @@ class Resolv raise StandardError.new("unsupported template: '#{byte.chr}' in '#{template}'") end } - raise DecodeError.new("limit exceed") if @limit < @index + len arr = @data.unpack("@#{@index}#{template}") @index += len return arr @@ -1193,7 +1193,7 @@ class Resolv def get_string len = @data[@index] - raise DecodeError.new("limit exceed") if @limit < @index + 1 + len d = @data[@index + 1, len] @index += 1 + len return d @@ -1554,7 +1554,7 @@ class Resolv raise ArgumentError.new("IPv4 address with invalid value: " + arg) end else - raise ArgumentError.new("cannot interprete as IPv4 address: #{arg.inspect}") end end @@ -1662,7 +1662,7 @@ class Resolv end return IPv6.new(address) else - raise ArgumentError.new("cannot interprete as IPv6 address: #{arg.inspect}") end end @@ -13,7 +13,7 @@ # a == b # => true # a.new # NoMethodError - new is private ... # -# * ``The instance'' is created at instanciation time, in other # words the first call of Klass.instance(), thus # # class OtherKlass @@ -44,11 +44,11 @@ # # * Klass._load(str) - calling Klass.instance() # -# * Klass._instanciate?() - returning ``the instance'' or # nil. This hook method puts a second (or nth) thread calling # Klass.instance() on a waiting loop. The return value # signifies the successful completion or premature termination -# of the first, or more generally, current "instanciation thread". # # # The instance method of Singleton are @@ -103,7 +103,7 @@ class << Singleton @__instance__ = nil # failed instance creation end end - elsif _instanciate?() Thread.critical = false else @__instance__ = false @@ -144,7 +144,7 @@ class << Singleton end # waiting-loop hook - def _instanciate?() while false.equal?(@__instance__) Thread.critical = false sleep(0.08) # timeout @@ -209,7 +209,7 @@ end -puts "\nThreaded example with exception and customized #_instanciate?() hook"; p Thread.abort_on_exception = false class Ups < SomeSingletonClass @@ -220,7 +220,7 @@ class Ups < SomeSingletonClass end class << Ups - def _instanciate? @enter.push Thread.current[:i] while false.equal?(@__instance__) Thread.critical = false @@ -247,7 +247,7 @@ class << Ups end end - def instanciate_all @enter = [] @leave = [] 1.upto(9) {|i| @@ -270,7 +270,7 @@ class << Ups end -Ups.instanciate_all # results in message like # Before there were 0 Ups instance(s) # boom - thread #6 failed to create instance @@ -293,7 +293,7 @@ def Yup.new end end end -Yup.instanciate_all puts "\n\n","Customized marshalling" @@ -9,7 +9,7 @@ require 'tmpdir' # A class for managing temporary files. This library is written to be # thread safe. -class Tempfile < SimpleDelegator MAX_TRY = 10 @@cleanlist = [] @@ -119,7 +119,7 @@ private return parts.dup end if parts.length != result.length - raise RuntimeError.new("Incomplete prarmeterOrder list.") end result end @@ -467,7 +467,7 @@ module XMLRPC else # is a normal return value raise "Missing return value!" if parser.params.size == 0 - raise "To many return values. Only one allowed!" if parser.params.size > 1 [true, parser.params[0]] end end |