Skip to content

Commit

Permalink
Updated exception description in GetZSwapAcceptThresholdPercent().
Browse files Browse the repository at this point in the history
  • Loading branch information
xvitaly committed Dec 22, 2021
1 parent 0e26399 commit 42c78aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/zswapobject/zswapobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ std::string& ZSwapObject::GetZSwapAcceptThresholdPercent()

void ZSwapObject::SetZSwapAcceptThresholdPercent(const std::string& Value)
{
if (CheckKernelVersion(ZSwapObject::ZSwapAcceptThresholdRequiredKernelVersion)) throw std::domain_error("This feature requires the Linux kernel 5.6 or later.");
if (CheckKernelVersion(ZSwapObject::ZSwapAcceptThresholdRequiredKernelVersion)) throw std::runtime_error("Configuring ZSwapAcceptThresholdPercent requires Linux kernel 5.6 or later.");
if (CheckPercent(Value)) throw std::invalid_argument("The value of ZSwapAcceptThresholdPercent is out of range [0..100].");
WriteLogEntry(ZSwapObject::ZSwapAcceptThresholdPercentName, Value, ZSwapObject::ZSwapAcceptThresholdPercent);
ZSwapObject::ZSwapAcceptThresholdPercent = Value;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/zswapobject/zswapobject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class ZSwapObject
/**
* Sets the accept threshold percentage value.
* @param Value New value.
* @exception Raises an instance of std::runtime_error if the Linux kernel
* version is too old.
* @exception Raises an instance of std::invalid_argument if cannot set
* the proposed value.
*/
Expand Down

0 comments on commit 42c78aa

Please sign in to comment.