Skip to content

Commit

Permalink
Replace throw with throw_exception in handleMallctlError
Browse files Browse the repository at this point in the history
Summary:
Do not use `throw` directly, use wrapper `throw_exception` to handle
cases, when exceptions are disabled.

Reviewed By: Gownta

Differential Revision: D66663952

fbshipit-source-id: 427ff7911b3c41f2132f876ac33181ec585d5dfd
  • Loading branch information
ilvokhin authored and facebook-github-bot committed Dec 3, 2024
1 parent 06c0c8d commit 39239da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions folly/memory/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cpp_library(
deps = [
"//folly:format",
"//folly:string",
"//folly/lang:exception",
],
exported_deps = [
":malloc",
Expand Down
3 changes: 2 additions & 1 deletion folly/memory/MallctlHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <folly/Format.h>
#include <folly/String.h>
#include <folly/lang/Exception.h>

#include <stdexcept>

Expand All @@ -28,7 +29,7 @@ namespace detail {
[[noreturn]] void handleMallctlError(const char* fn, const char* cmd, int err) {
assert(err != 0);
cmd = cmd ? cmd : "<none>";
throw std::runtime_error(
throw_exception<std::runtime_error>(
sformat("mallctl[{}] {}: {} ({})", fn, cmd, errnoStr(err), err));
}

Expand Down

0 comments on commit 39239da

Please sign in to comment.