Skip to content

Commit 4f9f662

Browse files
glebmxzyfer
authored andcommitted
Catch exceptions by reference
Fixes `-Wcatch-value` warnings reported by gcc 8.2.0
1 parent 6cb1927 commit 4f9f662

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/fn_strings.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace Sass {
1414
try {
1515
throw;
1616
}
17-
catch (utf8::invalid_code_point) {
17+
catch (utf8::invalid_code_point&) {
1818
std::string msg("utf8::invalid_code_point");
1919
error(msg, pstate, traces);
2020
}
21-
catch (utf8::not_enough_room) {
21+
catch (utf8::not_enough_room&) {
2222
std::string msg("utf8::not_enough_room");
2323
error(msg, pstate, traces);
2424
}
25-
catch (utf8::invalid_utf8) {
25+
catch (utf8::invalid_utf8&) {
2626
std::string msg("utf8::invalid_utf8");
2727
error(msg, pstate, traces);
2828
}

src/json.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ char *json_encode_string(const char *str)
402402
try {
403403
emit_string(&sb, str);
404404
}
405-
catch (std::exception) {
405+
catch (std::exception&) {
406406
sb_free(&sb);
407407
throw;
408408
}
@@ -421,7 +421,7 @@ char *json_stringify(const JsonNode *node, const char *space)
421421
else
422422
emit_value(&sb, node);
423423
}
424-
catch (std::exception) {
424+
catch (std::exception&) {
425425
sb_free(&sb);
426426
throw;
427427
}

0 commit comments

Comments
 (0)