// SPDX-License-Identifier: MIT
#include "DSOExceptions.hh"
#include <sstream>
#include <string>
#include "Exception.hh"
namespace fedem
{
namespace exception
{
static void streamFileNotFound( std::ostream& stream,
std::string const& filename,
std::string const& reason )
{
stream << "The file '";
stream << filename;
stream << "' is not found.\n";
stream << reason;
stream << "\n";
}
FileNotFound::FileNotFound( std::string const& filename,
std::string const& reason,
std::locale const& loc ) noexcept
: Exception( ),
internal_locale( loc ),
member_Filename( filename ),
member_Reason( reason )
{
}
FileNotFound::FileNotFound( std::string const& filename,
std::string const& reason ) noexcept
: Exception( ),
member_Filename( filename ),
member_Reason( reason )
{
}
std::string FileNotFound::whatStr( ) const noexcept
{
std::ostringstream stream;
stream.imbue( internal_locale );
streamFileNotFound( stream, member_Filename, member_Reason );
return stream.str( );
}
} // namespace exception
} // namespace fedem