// SPDX-License-Identifier: MIT
#pragma once
#include <Exception.hh>
#include <locale>
#include <string>
#include <dso/DSOVisibility.hh>
namespace fedem
{
namespace exception
{
class PLUGIN_EXPORT FileNotFound
: public Exception
{
public:
FileNotFound( std::string const& filename,
std::string const& reason,
std::locale const& loc ) noexcept;
FileNotFound( std::string const& filename,
std::string const& reason ) noexcept;
std::string whatStr( ) const noexcept override;
std::string missingFilename( ) const
{
return member_Filename;
}
std::string reason( ) const
{
return member_Reason;
}
private:
std::locale internal_locale;
std::string member_Filename;
std::string member_Reason;
};
// ── Signature / trust exceptions ─────────────────────────────────────────
/**
* Thrown by DSOLoader::loadVerified() when the DSO's trust level is
* below the required minimum (REJECTED, UNKNOWN, or UNSIGNED depending
* on the minTrust parameter).
*/
class PLUGIN_EXPORT SignatureRejected : public Exception
{
public:
SignatureRejected( std::string const& soPath,
std::string const& reason ) noexcept
: soPath_( soPath ), reason_( reason ) {}
std::string whatStr() const noexcept override
{
return "DSO signature check failed for \"" + soPath_
+ "\": " + reason_;
}
std::string const& soPath() const noexcept { return soPath_; }
std::string const& reason() const noexcept { return reason_; }
private:
std::string soPath_;
std::string reason_;
};
} // namespace exception
} // namespace fedem