Skip to content

Commit 27ab5bf

Browse files
Fix exceptions referenced in AlexandreRouma#1287
1 parent 159f59b commit 27ab5bf

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

core/src/command_args.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int CommandArgsParser::parse(int argc, char* argv[]) {
8888
try {
8989
carg.ival = std::stoi(arg);
9090
}
91-
catch (std::exception e) {
91+
catch (const std::exception& e) {
9292
printf("Invalid argument, failed to parse integer\n");
9393
showHelp();
9494
return -1;
@@ -98,7 +98,7 @@ int CommandArgsParser::parse(int argc, char* argv[]) {
9898
try {
9999
carg.fval = std::stod(arg);
100100
}
101-
catch (std::exception e) {
101+
catch (const std::exception& e) {
102102
printf("Invalid argument, failed to parse float\n");
103103
showHelp();
104104
return -1;

core/src/config.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ void ConfigManager::load(json def, bool lock) {
3636
file >> conf;
3737
file.close();
3838
}
39-
catch (std::exception e) {
40-
flog::error("Config file '{0}' is corrupted, resetting it", path);
39+
catch (const std::exception& e) {
40+
flog::error("Config file '{}' is corrupted, resetting it: {}", path, e.what());
4141
conf = def;
4242
save(false);
4343
}

core/src/utils/networking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ namespace net {
320320
}
321321
entry.handler(std::move(client), entry.ctx);
322322
}
323-
catch (std::exception e) {
323+
catch (const std::exception& e) {
324324
listening = false;
325325
return;
326326
}

misc_modules/rigctl_client/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class RigctlClientModule : public ModuleManager::Instance {
8080
try {
8181
client = net::rigctl::connect(host, port);
8282
}
83-
catch (std::exception e) {
84-
flog::error("Could not connect: {0}", e.what());
83+
catch (const std::exception& e) {
84+
flog::error("Could not connect: {}", e.what());
8585
return;
8686
}
8787

misc_modules/rigctl_server/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ class SigctlServerModule : public ModuleManager::Instance {
200200
listener = net::listen(hostname, port);
201201
listener->acceptAsync(clientHandler, this);
202202
}
203-
catch (std::exception e) {
204-
flog::error("Could not start rigctl server: {0}", e.what());
203+
catch (const std::exception& e) {
204+
flog::error("Could not start rigctl server: {}", e.what());
205205
}
206206
}
207207

source_modules/airspy_source/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ class AirspySourceModule : public ModuleManager::Instance {
141141
return;
142142
}
143143
}
144-
catch (std::exception e) {
144+
catch (const std::exception& e) {
145145
char buf[1024];
146146
sprintf(buf, "%016" PRIX64, serial);
147-
flog::error("Could not open Airspy {0}", buf);
147+
flog::error("Could not open Airspy {}", buf);
148148
}
149149
selectedSerial = serial;
150150

source_modules/airspyhf_source/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ class AirspyHFSourceModule : public ModuleManager::Instance {
144144
return;
145145
}
146146
}
147-
catch (std::exception e) {
147+
catch (const std::exception& e) {
148148
char buf[1024];
149149
sprintf(buf, "%016" PRIX64, serial);
150-
flog::error("Could not open Airspy HF+ {0}", buf);
150+
flog::error("Could not open Airspy HF+ {}", buf);
151151
}
152152

153153
selectedSerial = serial;

source_modules/audio_source/src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ class AudioSourceModule : public ModuleManager::Instance {
200200
_this->audio.startStream();
201201
_this->running = true;
202202
}
203-
catch (std::exception e) {
204-
flog::error("Error opening audio device: {0}", e.what());
203+
catch (const std::exception& e) {
204+
flog::error("Error opening audio device: {}", e.what());
205205
}
206206

207-
flog::info("AudioSourceModule '{0}': Start!", _this->name);
207+
flog::info("AudioSourceModule '{}': Start!", _this->name);
208208
}
209209

210210
static void stop(void* ctx) {

source_modules/file_source/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ class FileSourceModule : public ModuleManager::Instance {
139139
//gui::freqSelect.maxFreq = _this->centerFreq + (_this->sampleRate/2);
140140
//gui::freqSelect.limitFreq = true;
141141
}
142-
catch (std::exception& e) {
143-
flog::error("Error: {0}", e.what());
142+
catch (const std::exception& e) {
143+
flog::error("Error: {}", e.what());
144144
}
145145
config.acquire();
146146
config.conf["path"] = _this->fileSelect.path;

source_modules/rfspace_source/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class RFSpaceSourceModule : public ModuleManager::Instance {
154154
_this->client = rfspace::connect(_this->hostname, _this->port, &_this->stream);
155155
_this->deviceInit();
156156
}
157-
catch (std::exception e) {
158-
flog::error("Could not connect to SDR: {0}", e.what());
157+
catch (const std::exception& e) {
158+
flog::error("Could not connect to SDR: {}", e.what());
159159
}
160160
}
161161
else if (connected && SmGui::Button("Disconnect##rfspace_source")) {

0 commit comments

Comments
 (0)