Refactoring error message and redis cmd.