#ifndef BIBUNM_EXCEPTION_H
#define BIBUNM_EXCEPTION_H

#include "bibun_util/exception.h"

namespace bibunm
{

class Exception : public bibunu::Exception
{
public:
   Exception() = delete; // We will need more details about what happened.
   Exception(std::string message);

   // Trivially copyable as members are strings and vectors.
   Exception(const Exception&) = default;
   Exception(Exception&&) = default;

   virtual const char *what() const noexcept;

   virtual ~Exception();
private:
   std::string _message;
   std::vector<std::string> _context_trace;
};

// An exception that indicates that messages are formatted incorrectly, or there is
// an attempt to format one incorrectly by a user. You shouldn't really handle this
// close to the error source... instead, bibund uses it to check for errors, and it
// indicates to you that you are doing something foolish.
class ProtocolError : public Exception
{
public:
   ProtocolError(std::string error_message);

   ProtocolError(const ProtocolError&) = default;
   ProtocolError(ProtocolError&&) = default;

   virtual ~ProtocolError();
};

}

#endif // BIBUNM_EXCEPTION_H
