Skip to content

Commit

Permalink
Catch exceptions by reference
Browse files Browse the repository at this point in the history
Fixes `-Wcatch-value` warnings reported by gcc 8.2.0
  • Loading branch information
glebm authored and xzyfer committed Dec 17, 2018
1 parent 6cb1927 commit 4f9f662
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/fn_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ namespace Sass {
try {
throw;
}
catch (utf8::invalid_code_point) {
catch (utf8::invalid_code_point&) {
std::string msg("utf8::invalid_code_point");
error(msg, pstate, traces);
}
catch (utf8::not_enough_room) {
catch (utf8::not_enough_room&) {
std::string msg("utf8::not_enough_room");
error(msg, pstate, traces);
}
catch (utf8::invalid_utf8) {
catch (utf8::invalid_utf8&) {
std::string msg("utf8::invalid_utf8");
error(msg, pstate, traces);
}
Expand Down
4 changes: 2 additions & 2 deletions src/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ char *json_encode_string(const char *str)
try {
emit_string(&sb, str);
}
catch (std::exception) {
catch (std::exception&) {
sb_free(&sb);
throw;
}
Expand All @@ -421,7 +421,7 @@ char *json_stringify(const JsonNode *node, const char *space)
else
emit_value(&sb, node);
}
catch (std::exception) {
catch (std::exception&) {
sb_free(&sb);
throw;
}
Expand Down

0 comments on commit 4f9f662

Please sign in to comment.