Created a special error class for handling graecful rollbacks (not sure if Madeleine can take it yet)

This commit is contained in:
Alexey Verkhovsky 2005-01-17 21:22:41 +00:00
parent 8f5ac3440a
commit 7780a13fe8
2 changed files with 16 additions and 0 deletions

View file

@ -42,6 +42,7 @@ end
require 'action_controller' require 'action_controller'
require 'active_record_stub' require 'active_record_stub'
require 'instiki_errors'
unless defined? RAILS_DEFAULT_LOGGER unless defined? RAILS_DEFAULT_LOGGER
RAILS_DEFAULT_LOGGER = Logger.new(STDERR) RAILS_DEFAULT_LOGGER = Logger.new(STDERR)

View file

@ -0,0 +1,15 @@
# Model methods that want to rollback transactions gracefully
# (i.e, returning the user back to the form from which the request was posted)
# should raise Instiki::ValidationError.
#
# E.g. if a model object does
# raise "Foo: '#{foo}' is not equal to Bar: '#{bar}'" if (foo != bar)
#
# then the operation is not committed; Rails returns the user to the page
# where s/he was entering foo and bar, and the error message will be displayed
# on the page
module Instiki
class ValidationError < StandardError
end
end