ExceptionGeneric.hpp 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "Exception.hpp"
  3. namespace ARL {
  4. #pragma push_macro("DECLARE_NEW_EXCEPTION")
  5. #undef DECLARE_NEW_EXCEPTION
  6. #define DECLARE_NEW_EXCEPTION(name) \
  7. class name final : public Exception { \
  8. public: \
  9. template<typename... __ArgTypes> \
  10. name(const char* SourceFile, size_t SourceLine, const char* Format, __ArgTypes&&... Args) noexcept : \
  11. Exception(SourceFile, SourceLine, Format, std::forward<__ArgTypes>(Args)...) {} \
  12. }
  13. DECLARE_NEW_EXCEPTION(AssertionError);
  14. DECLARE_NEW_EXCEPTION(EOFError);
  15. DECLARE_NEW_EXCEPTION(IndexError);
  16. DECLARE_NEW_EXCEPTION(KeyError);
  17. DECLARE_NEW_EXCEPTION(NotImplementedError);
  18. DECLARE_NEW_EXCEPTION(OverflowError);
  19. DECLARE_NEW_EXCEPTION(ValueError);
  20. #undef DECLARE_NEW_EXCEPTION
  21. #pragma pop_macro("DECLARE_NEW_EXCEPTION")
  22. }