Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch polymorphic exceptions by reference #1887

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/test_rosbag/test/test_bag.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ TEST_F(BagTest, bag_not_open_fails) {
b.write("/test", ros::Time::now(), foo_);
FAIL();
}
catch (rosbag::BagIOException ex) {
catch (const rosbag::BagIOException& ex) {
SUCCEED();
}
}
Expand Down Expand Up @@ -224,7 +224,7 @@ TEST(rosbag, append_indexed_1_2_fails) {

FAIL();
}
catch (rosbag::BagException ex) {
catch (const rosbag::BagException& ex) {
SUCCEED();
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ TEST(rosbag, write_then_read_without_read_mode_fails) {
}
FAIL();
}
catch (rosbag::BagException ex) {
catch (const rosbag::BagException& ex) {
SUCCEED();
}
}
Expand All @@ -279,7 +279,7 @@ TEST_F(BagTest, read_then_write_without_write_mode_fails) {
b2.write("chatter", ros::Time::now(), foo_);
FAIL();
}
catch (rosbag::BagException ex) {
catch (const rosbag::BagException& ex) {
SUCCEED();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/rosbag_storage/src/bag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void Bag::startReadingVersion102() {
// Read the file header record, which points to the start of the topic indexes
readFileHeaderRecord();
}
catch (BagFormatException ex) {
catch (const BagFormatException& ex) {
throw BagUnindexedException();
}

Expand Down