Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Commit 46417b4

Browse files
committed
remove some raises of exceptions when it is notereally pleasant for the user
1 parent afab959 commit 46417b4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sources/network/tcp_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tcp_client::~tcp_client(void) {
2121
void
2222
tcp_client::connect(const std::string& host, unsigned int port) {
2323
if (m_is_connected)
24-
throw redis_error("Already connected");
24+
return ;
2525

2626
std::condition_variable conn_cond_var;
2727

@@ -55,7 +55,7 @@ tcp_client::connect(const std::string& host, unsigned int port) {
5555
void
5656
tcp_client::disconnect(void) {
5757
if (not m_is_connected)
58-
throw redis_error("Not connected");
58+
return ;
5959

6060
m_is_connected = false;
6161

sources/redis_subscriber.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ redis_subscriber::unsubscribe(const std::string& channel) {
5757

5858
auto it = m_subscribed_channels.find(channel);
5959
if (it == m_subscribed_channels.end())
60-
throw redis_error("Not subscribed to channel " + channel);
60+
return ;
6161

6262
m_client.send({ "UNSUBSCRIBE", channel });
6363
m_subscribed_channels.erase(it);
@@ -69,7 +69,7 @@ redis_subscriber::punsubscribe(const std::string& pattern) {
6969

7070
auto it = m_psubscribed_channels.find(pattern);
7171
if (it == m_psubscribed_channels.end())
72-
throw redis_error("Not psubscribed to pattern " + pattern);
72+
return ;
7373

7474
m_client.send({ "PUNSUBSCRIBE", pattern });
7575
m_psubscribed_channels.erase(it);

0 commit comments

Comments
 (0)