Defined in <dso/DSOExceptions.hh> (which includes <Exception.hh>). Link dsold.

Both types derive from Exception, the toolkit's base exception, which provides whatStr() (and, through the standard hierarchy, what()).

FileNotFound

class FileNotFound : public Exception
{
public:
    FileNotFound( std::string const& filename, std::string const& reason ) noexcept;
    FileNotFound( std::string const& filename, std::string const& reason,
                  std::locale const& loc ) noexcept;

    std::string whatStr() const noexcept override;
    std::string missingFilename() const;   // the name that failed
    std::string reason() const;            // the dlerror() text
};

Thrown by:

try {
    DSOLoader::loadAll( ".so", pluginDir );
} catch( fedem::exception::FileNotFound const& e ) {
    std::clog << "some plugins failed: " << e.missingFilename()
              << " — " << e.reason() << '\n';
}

SignatureRejected

class SignatureRejected : public Exception
{
public:
    SignatureRejected( std::string const& soPath, std::string const& reason ) noexcept;

    std::string whatStr() const noexcept override;    // "DSO signature check failed for \"...\": ..."
    std::string const& soPath() const noexcept;
    std::string const& reason() const noexcept;
};

Thrown by DSOLoader::loadVerified when the DSO's TrustLevel is below the requested minTrust (so: REJECTED, UNSIGNED, or UNKNOWN, depending on the floor). loadSigned never throws this — it reports the level in its result instead.

Only present when dsold is built with plugin-sign.

try {
    DSOLoader::loadVerified( "libCircle.so", dirs, keysDir,
                             fedem::sign::TrustLevel::TRUSTED );
} catch( fedem::exception::SignatureRejected const& e ) {
    fatal( "untrusted plugin " + e.soPath() + ": " + e.reason() );
}

Notes

  • Catch fedem::exception::Exception const& to handle both (and any other library exception) in one clause; catch the leaf types when you need missingFilename() / soPath().
  • PluginCatalog / Plugin::create do not throw these — an unknown key is a nullptr return. They can propagate std::runtime_error / std::bad_any_cast from the config path (see Creator).