go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

Avoid using panic in Redis Commands

Open ofekshenawa opened this issue 1 year ago • 2 comments

In various functions within the go-redis library, there is a use of panic to handle cases. Using panic for this purpose is not in line with Go's idiomatic error handling and can result in unexpected program termination.

Suggested Improvement: Replace occurrences of panic with a more idiomatic error return approach. This allows users to handle argument validation errors gracefully through error checks and aligns with Go's standard error handling practices.

ofekshenawa avatar Dec 17 '23 13:12 ofekshenawa

Can you illustrate an example of how we can solve this? I would like to help with this @ofekshenawa

SoulPancake avatar Dec 19 '23 14:12 SoulPancake

Can you illustrate an example of how we can solve this? I would like to help with this @ofekshenawa

By using a middleware to capture panics and return as error perhaps.

mushsoooup avatar Dec 24 '23 04:12 mushsoooup