Skip to content

Commit 969da83

Browse files
committed
Specialize the NOSCRIPT error
1 parent 5c3ffbe commit 969da83

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- Add `RedisClient::NoScriptError` for `EVALSHA`.
4+
35
# 0.24.0
46

57
- Allow `sentinel_password` to be provided as a `Proc`.

lib/redis_client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def parse(error_message)
153153
PermissionError = Class.new(CommandError)
154154
WrongTypeError = Class.new(CommandError)
155155
OutOfMemoryError = Class.new(CommandError)
156+
NoScriptError = Class.new(CommandError)
156157

157158
ReadOnlyError = Class.new(ConnectionError)
158159
ReadOnlyError.include(HasCommand)
@@ -167,6 +168,7 @@ def parse(error_message)
167168
"MASTERDOWN" => MasterDownError,
168169
"WRONGTYPE" => WrongTypeError,
169170
"OOM" => OutOfMemoryError,
171+
"NOSCRIPT" => NoScriptError,
170172
}.freeze
171173

172174
class << self

test/redis_client/connection_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ def test_oom_errors
280280
end
281281
end
282282

283+
def test_script_errors
284+
assert_raises RedisClient::NoScriptError do
285+
@redis.call("EVALSHA", "invalid", 0)
286+
end
287+
end
288+
283289
private
284290

285291
def assert_timeout(error, faster_than = ClientTestHelper::DEFAULT_TIMEOUT + 0.2, &block)

0 commit comments

Comments
 (0)