Skip to content

Commit f8847d0

Browse files
committed
fix bugprone-empty-catch
Signed-off-by: Matt Liberty <[email protected]>
1 parent aabacb6 commit f8847d0

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

src/gui/include/gui/gui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ class Renderer
615615
if (settings.count(key) == 1) {
616616
try {
617617
value = std::get<T>(settings.at(key));
618+
// NOLINTNEXTLINE(bugprone-empty-catch)
618619
} catch (const std::bad_variant_access&) {
619620
// Stay with current value
620621
}

src/gui/src/dbDescriptors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,9 +2726,9 @@ Descriptor::Editors DbBlockageDescriptor::getEditors(
27262726
blockage->setMaxDensity(density);
27272727
return true;
27282728
}
2729-
} catch (std::out_of_range&) {
2729+
} catch (std::out_of_range&) { // NOLINT(bugprone-empty-catch)
27302730
// catch poorly formatted string
2731-
} catch (std::logic_error&) {
2731+
} catch (std::logic_error&) { // NOLINT(bugprone-empty-catch)
27322732
// catch poorly formatted string
27332733
}
27342734
}

src/gui/src/drcWidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ void DRCWidget::loadReport(const QString& filename)
370370
"Unable to determine type of {}",
371371
filename.toStdString());
372372
}
373-
} catch (std::runtime_error&) {
373+
} catch (std::runtime_error& e) {
374+
logger_->warn(utl::GUI, 110, "Failed to load: {}", e.what());
374375
} // catch errors
375376

376377
if (category != nullptr) {

src/gui/src/mainWindow.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,9 @@ void MainWindow::saveDesign()
19371937

19381938
try {
19391939
ord::OpenRoad::openRoad()->writeDb(file.toStdString().c_str());
1940-
} catch (const std::exception&) {
1940+
} catch (const std::exception& e) {
1941+
QMessageBox::warning(
1942+
this, "Save Error", QString("Db save failed: %1").arg(e.what()));
19411943
}
19421944
}
19431945

src/utl/src/prometheus/metrics_server.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ PrometheusMetricsServer::~PrometheusMetricsServer()
6767
boost::asio::ip::tcp::socket socket(io_context);
6868
boost::asio::ip::tcp::endpoint endpoint(
6969
boost::asio::ip::make_address("127.0.0.1"), port_);
70-
socket.connect(endpoint); // This will unblock the accept().
71-
} catch (const std::exception& e) { /*Do nothing, we're dying*/
70+
socket.connect(endpoint); // This will unblock the accept().
71+
} catch (const std::exception& e) { // NOLINT(bugprone-empty-catch)
72+
/*Do nothing, we're dying*/
7273
}
7374
}
7475
worker_thread_.join();

0 commit comments

Comments
 (0)