#ifndef RTX_SERIALIZABLE_EXCEPTION_H
#define RTX_SERIALIZABLE_EXCEPTION_H

#include "BaseException.h"

namespace rtx
{
    namespace exception
    {
        class SerializationException : public BaseException
        {
        public:
            SerializationException(ErrorCode code,
                          const std::string &message,
                          const char *file,
                          int line,
                          const char *function)
                : BaseException(code, message, file, line, function)
            {
                buildWhatString();
            }

        protected:
            virtual void buildWhatString()
            {
                BaseException::buildWhatString();
            }        
        };
    }
}

// 序列化异常宏
#define THROW_SERIALIZABLE_EXCEPTION(code, msg) \
    throw rtx::exception::SerializationException(code, msg, __FILE__, __LINE__, __func__)


#endif