aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/errors.rb
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-12-05 15:36:29 -0500
committerEileen Uchitelle <eileencodes@gmail.com>2018-12-07 08:53:47 -0500
commitdb54afba2e86ec9e45a8feb6e3ed325c99e7c5ed (patch)
treea41277a318319b5ca5cd2e9b33315ba5699dbfea /activerecord/lib/active_record/errors.rb
parentd9816546494f66e76bd5012a91b872dc2096a06c (diff)
downloadrails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.tar.gz
rails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.tar.bz2
rails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.zip
Rename error that occurs when writing on a read
I originally named this `StatementInvalid` because that's what we do in GitHub, but `@tenderlove` pointed out that this means apps can't test for or explitly rescue this error. `StatementInvalid` is pretty broad so I've renamed this to `ReadOnlyError`.
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r--activerecord/lib/active_record/errors.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb
index 7e6d4c1d46..0858af3874 100644
--- a/activerecord/lib/active_record/errors.rb
+++ b/activerecord/lib/active_record/errors.rb
@@ -49,6 +49,10 @@ module ActiveRecord
class ConnectionNotEstablished < ActiveRecordError
end
+ # Raised when a write to the database is attempted on a read only connection.
+ class ReadOnlyError < ActiveRecordError
+ end
+
# Raised when Active Record cannot find a record by given id or set of ids.
class RecordNotFound < ActiveRecordError
attr_reader :model, :primary_key, :id