Sha256: 6f60cb3eac073b41c11d86e1eb6dacafa3d77fe799ff8885e968c1c084359a65

Contents?: true

Size: 1.9 KB

Versions: 3

Compression:

Stored size: 1.9 KB

Contents

# -*- ruby -*-
# frozen_string_literal: true

#--
module Mongrel2

	# A base exception class.
	class Exception < ::RuntimeError; end

	# An exception class raised from a Mongrel2::Request when
	# a problem is encountered while parsing raw request data.
	class ParseError < Mongrel2::Exception; end

	# An exception class raised from a Mongrel2::Request when
	# the raw request headers contain an unhandled METHOD.
	class UnhandledMethodError < Mongrel2::Exception

		### Set the +method_name+ that was unhandled.
		def initialize( method_name, *args )
			@method_name = method_name
			super( "Unhandled method %p" % [ method_name ], *args )
		end

		# The METHOD that was unhandled
		attr_reader :method_name

	end # class UnhandledMethodError

	# An exception class raised when an attempt is made to use a
	# Mongrel2::Connection after it has been closed.
	class ConnectionError < Mongrel2::Exception; end

	# An exception type raised when an operation requires that a configuration
	# database be configured but none was; if it's configured but doesn't
	# exist; or if it doesn't contain the information requested.
	class ConfigError < Mongrel2::Exception; end

	# An exception type raised by a response if it can't generate a valid response
	# document
	class ResponseError < Mongrel2::Exception; end

	# An exception type raised by Mongrel2::Control requests if they result in
	# an error response.
	class ControlError < Mongrel2::Exception

		### Set the error +code+ in addition to the +message+.
		def initialize( code, message )
			@code = code.to_sym
			super( message )
		end

		# The code of the particular kind of control error (a Symbol)
		attr_reader :code

	end # class ControlError

	# An exception type raised by Mongrel2::HTTPRequest if an async upload request is
	# received, but has different Mongrel2 upload headers.
	class UploadError < Mongrel2::Exception; end

end # module Mongrel2


# vim: set noet nosta sw=4 ts=4 :

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongrel2-0.55.0 lib/mongrel2/exceptions.rb
mongrel2-0.54.0 lib/mongrel2/exceptions.rb
mongrel2-0.53.0 lib/mongrel2/exceptions.rb