$EXCEPTION ENABLE INHERITED std::exception
$MESSAGE NotFound
@ path std::string const &
"not found: {$path}"
class NotFoundException
  : public std::exception
{
    std::locale internal_locale;
    std::decay_t< std::string const & > member_path;
    std::string internal_what;

  public:
    NotFoundException( std::string const & path, std::locale const &loc );
    explicit NotFoundException( std::string const & path );
    virtual ~NotFoundException( );

    virtual std::string What( ) const;          // the message
    char const *what( ) const noexcept;         // the same, for std::exception

    std::decay_t< std::string const & > const &path( ) const;
};
  • The constructor stores the parameters and the locale (the global one, without loc) and formats the text once, so what() never allocates or throws.
  • What() formats it again, as a std::string.
  • The base (INHERITED, public by default) is default-constructed.
  • The class is generated when $EXCEPTION or $THROW is enabled.

OVERRIDE

When the base implements what() itself on top of a pure virtual text method, OVERRIDE name implements that method instead:

$EXCEPTION INHERITED PUBLIC Exception OVERRIDE whatStr
std::string whatStr( ) const noexcept override;

No What(), no what(), no cached text. OVERRIDE needs an INHERITED base. See the dsold walkthrough.