add more context to exception message (#858)
* add more context to exception message Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * fix linter warnings Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
This commit is contained in:
parent
9b47f36080
commit
b6d18ccc81
1 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "rclcpp/clock.hpp"
|
#include "rclcpp/clock.hpp"
|
||||||
|
@ -194,7 +195,10 @@ Duration
|
||||||
Time::operator-(const rclcpp::Time & rhs) const
|
Time::operator-(const rclcpp::Time & rhs) const
|
||||||
{
|
{
|
||||||
if (rcl_time_.clock_type != rhs.rcl_time_.clock_type) {
|
if (rcl_time_.clock_type != rhs.rcl_time_.clock_type) {
|
||||||
throw std::runtime_error("can't subtract times with different time sources");
|
throw std::runtime_error(
|
||||||
|
std::string("can't subtract times with different time sources [") +
|
||||||
|
std::to_string(rcl_time_.clock_type) + " != " +
|
||||||
|
std::to_string(rhs.rcl_time_.clock_type) + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rclcpp::sub_will_overflow(rcl_time_.nanoseconds, rhs.rcl_time_.nanoseconds)) {
|
if (rclcpp::sub_will_overflow(rcl_time_.nanoseconds, rhs.rcl_time_.nanoseconds)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue