Skip to content

Commit

Permalink
Add a couple of throws for bad states
Browse files Browse the repository at this point in the history
  • Loading branch information
r-barnes committed Jan 24, 2024
1 parent 914a4f1 commit 85c2fb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion folly/experimental/io/EpollBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ void SignalRegistry::notify(int sig) {
int fd = notifyFd_.load();
if (fd >= 0) {
uint8_t sigNum = static_cast<uint8_t>(sig);
::write(fd, &sigNum, 1);
if(::write(fd, &sigNum, 1)!=1){
throw std::runtime_error("Failed to write all the byes.");
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions folly/experimental/settings/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <folly/experimental/settings/Types.h>

#include <string_view>

namespace folly {
namespace settings {

Expand All @@ -27,6 +29,8 @@ std::string_view toString(SetErrorCode code) {
return "rejected";
case SetErrorCode::FrozenImmutable:
return "frozen immutable";
default:
throw std::invalid_argument("Code '" + std::to_string(static_cast<int>(code)) + "' had no string representation!");
}
}

Expand Down

0 comments on commit 85c2fb7

Please sign in to comment.