Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting NameError: uninitialized constant Redis::Error error #1286

Closed
junyuanz1 opened this issue Aug 15, 2024 · 5 comments
Closed

getting NameError: uninitialized constant Redis::Error error #1286

junyuanz1 opened this issue Aug 15, 2024 · 5 comments

Comments

@junyuanz1
Copy link
Contributor

junyuanz1 commented Aug 15, 2024

reproduce code

redis = ::Redis.new(
  url: something
)

redis.multi do |transaction|
  transaction.multi do |nested_transaction|
    puts "something"
  end
end

i got error like:

NameError: uninitialized constant Redis::Error

I can see Redis::Error is used here

raise Redis::Error, "Can't nest multi transaction"

But I am not sure where it is coming from; maybe this has something to do with our project setup or auto-loading.

@byroot
Copy link
Collaborator

byroot commented Aug 15, 2024

Please share a complete backtrace.

@byroot
Copy link
Collaborator

byroot commented Aug 15, 2024

Actually nevermind, the bug is relatively obvious. Just note that your code still won't work after the fix.

@junyuanz1
Copy link
Contributor Author

junyuanz1 commented Aug 15, 2024

yeah, I am aware of that this code won't work.

just want to confirm thatNameError: uninitialized constant Redis::Error is a bug and it is not caused by my configuration?

@byroot
Copy link
Collaborator

byroot commented Aug 15, 2024

Yeah, it should raise a Redis::BaseError or something instead. You can't nest transactions so it should raise, just not the error it's currently raising.

@junyuanz1
Copy link
Contributor Author

okay, let me create a PR for this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants