Module: MockRedis::Error
- Defined in:
- lib/mock_redis/error.rb
Class Method Summary collapse
- .build(error_class, message, database) ⇒ Object
- .command_error(message, database) ⇒ Object
- .syntax_error(database) ⇒ Object
- .wrong_type_error(database) ⇒ Object
Class Method Details
.build(error_class, message, database) ⇒ Object
5 6 7 8 9 |
# File 'lib/mock_redis/error.rb', line 5 def build(error_class, , database) connection = database.connection url = "redis://#{connection[:host]}:#{connection[:port]}" error_class.new("#{} (#{url})") end |
.command_error(message, database) ⇒ Object
23 24 25 |
# File 'lib/mock_redis/error.rb', line 23 def command_error(, database) build(Redis::CommandError, , database) end |
.syntax_error(database) ⇒ Object
19 20 21 |
# File 'lib/mock_redis/error.rb', line 19 def syntax_error(database) command_error('ERR syntax error', database) end |
.wrong_type_error(database) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/mock_redis/error.rb', line 11 def wrong_type_error(database) build( Redis::WrongTypeError, 'WRONGTYPE Operation against a key holding the wrong kind of value', database ) end |