ExceptionGeneric.hpp 1.2 KB

1234567891011121314151617181920212223242526272829
  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. }