mergerfs/src/error.hpp
trapexit 569a151da2
Some checks failed
CodeQL / Analyze (push) Has been cancelled
mkdocs / deploy (push) Has been cancelled
Add ability to proxy ioprio of client apps (#1534)
2025-09-26 11:36:56 -05:00

41 lines
485 B
C++

#pragma once
#include "errno.hpp"
#include <optional>
struct Err
{
private:
std::optional<int> _err;
public:
Err()
{
}
operator int()
{
return (_err.has_value() ? _err.value() : -ENOENT);
}
Err&
operator=(int v_)
{
if(!_err.has_value())
_err = ((v_ >= 0) ? 0 : v_);
else if(v_ >= 0)
_err = 0;
return *this;
}
bool
operator==(int v_)
{
if(_err.has_value())
return (_err.value() == v_);
return false;
}
};