diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-30 19:34:26 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-30 19:34:26 -0300 |
commit | 9c70442534c7754eac3738e0ddf11446b01c4f9e (patch) | |
tree | 7af8614ad91e7400735a6be1b36dca704d87e3b6 /activerecord/lib/active_record/base.rb | |
parent | 50f73bd39c729b4ba4b5215b608e5767ab0aa7a1 (diff) | |
parent | b5dfdc714fab7d2836e0a979ca88b4a17db9ec06 (diff) | |
download | rails-9c70442534c7754eac3738e0ddf11446b01c4f9e.tar.gz rails-9c70442534c7754eac3738e0ddf11446b01c4f9e.tar.bz2 rails-9c70442534c7754eac3738e0ddf11446b01c4f9e.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/test/cases/adapter_test.rb
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c7fc1fa124..b3ecd01348 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -67,6 +67,25 @@ module ActiveRecord #:nodoc: class StatementInvalid < ActiveRecordError end + # Parent class for all specific exceptions which wrap database driver exceptions + # provides access to the original exception also. + class WrappedDatabaseException < StatementInvalid + attr_reader :original_exception + + def initialize(message, original_exception) + super(message) + @original_exception, = original_exception + end + end + + # Raised when a record cannot be inserted because it would violate a uniqueness constraint. + class RecordNotUnique < WrappedDatabaseException + end + + # Raised when a record cannot be inserted or updated because it references a non-existent record. + class InvalidForeignKey < WrappedDatabaseException + end + # Raised when number of bind variables in statement given to <tt>:condition</tt> key (for example, when using +find+ method) # does not match number of expected variables. # |