Skip to content

Commit

Permalink
Catch polymorphic exceptions by reference (#138)
Browse files Browse the repository at this point in the history
Signed-off-by: Scott K Logan <logans@cottsay.net>
  • Loading branch information
cottsay authored Jul 27, 2019
1 parent 93baeac commit e29db0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tf2_ros/src/create_timer_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CreateTimerROS::reset(const TimerHandle & timer_handle)
std::lock_guard<std::mutex> lock(timers_map_mutex_);
try {
timers_map_.at(timer_handle)->reset();
} catch (const std::out_of_range) {
} catch (const std::out_of_range &) {
throw InvalidTimerHandleException("Invalid timer handle in reset()");
}
}
Expand All @@ -87,7 +87,7 @@ CreateTimerROS::remove(const TimerHandle & timer_handle)
std::lock_guard<std::mutex> lock(timers_map_mutex_);
try {
cancelNoLock(timer_handle);
} catch (const InvalidTimerHandleException) {
} catch (const InvalidTimerHandleException &) {
throw InvalidTimerHandleException("Invalid timer handle in remove()");
}
timers_map_.erase(timer_handle);
Expand All @@ -98,7 +98,7 @@ CreateTimerROS::cancelNoLock(const TimerHandle & timer_handle)
{
try {
timers_map_.at(timer_handle)->cancel();
} catch (const std::out_of_range) {
} catch (const std::out_of_range &) {
throw InvalidTimerHandleException("Invalid timer handle in cancel()");
}
}
Expand Down

0 comments on commit e29db0a

Please sign in to comment.