aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/exceptions.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-08-06 19:52:11 -0300
committerYehuda Katz <wycats@gmail.com>2009-08-06 19:52:11 -0300
commitbd6b61be88dfe6eb1ff1dcc5c17542d804a842c7 (patch)
tree13be5181476dc71aca97bbefb795eeb814949e0e /actionpack/lib/action_controller/metal/exceptions.rb
parent52798fd479d4acbf823d093b03bdd1acf8e86b62 (diff)
downloadrails-bd6b61be88dfe6eb1ff1dcc5c17542d804a842c7.tar.gz
rails-bd6b61be88dfe6eb1ff1dcc5c17542d804a842c7.tar.bz2
rails-bd6b61be88dfe6eb1ff1dcc5c17542d804a842c7.zip
Rename /base to /metal and make base.rb and metal.rb top-level to reflect their module locations
Diffstat (limited to 'actionpack/lib/action_controller/metal/exceptions.rb')
-rw-r--r--actionpack/lib/action_controller/metal/exceptions.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/exceptions.rb b/actionpack/lib/action_controller/metal/exceptions.rb
new file mode 100644
index 0000000000..d0811254cb
--- /dev/null
+++ b/actionpack/lib/action_controller/metal/exceptions.rb
@@ -0,0 +1,58 @@
+module ActionController
+ class ActionControllerError < StandardError #:nodoc:
+ end
+
+ class SessionRestoreError < ActionControllerError #:nodoc:
+ end
+
+ class RenderError < ActionControllerError #:nodoc:
+ end
+
+ class RoutingError < ActionControllerError #:nodoc:
+ attr_reader :failures
+ def initialize(message, failures=[])
+ super(message)
+ @failures = failures
+ end
+ end
+
+ class MethodNotAllowed < ActionControllerError #:nodoc:
+ attr_reader :allowed_methods
+
+ def initialize(*allowed_methods)
+ super("Only #{allowed_methods.to_sentence(:locale => :en)} requests are allowed.")
+ @allowed_methods = allowed_methods
+ end
+
+ def allowed_methods_header
+ allowed_methods.map { |method_symbol| method_symbol.to_s.upcase } * ', '
+ end
+
+ def handle_response!(response)
+ response.headers['Allow'] ||= allowed_methods_header
+ end
+ end
+
+ class NotImplemented < MethodNotAllowed #:nodoc:
+ end
+
+ class UnknownController < ActionControllerError #:nodoc:
+ end
+
+ class MissingFile < ActionControllerError #:nodoc:
+ end
+
+ class RenderError < ActionControllerError #:nodoc:
+ end
+
+ class SessionOverflowError < ActionControllerError #:nodoc:
+ DEFAULT_MESSAGE = 'Your session data is larger than the data column in which it is to be stored. You must increase the size of your data column if you intend to store large data.'
+
+ def initialize(message = nil)
+ super(message || DEFAULT_MESSAGE)
+ end
+ end
+
+ class UnknownHttpMethod < ActionControllerError #:nodoc:
+ end
+end \ No newline at end of file