diff --git a/src/utils/PastisAssert.hpp b/src/utils/PastisAssert.hpp
index 7acded2a560497d9c56a11ff2d81f05d39b284f2..a6342a41ee604a861f928d6ede2e9592df0f6bae 100644
--- a/src/utils/PastisAssert.hpp
+++ b/src/utils/PastisAssert.hpp
@@ -10,17 +10,55 @@
 #else // NDEBUG
 
 #include <rang.hpp>
+#include <iostream>
+#include <string>
 
-#define Assert(assertion)                       \
-  if (not (assertion)) {                        \
-    std::cerr << rang::style::bold              \
-              << "Assertion \""                 \
-              << rang::fg::red                  \
-              << #assertion                     \
-              << rang::fg::reset                \
-              << "\" failed\n"                  \
-              << rang::style::reset;            \
-    std::exit(1);                               \
+class AssertError
+{
+ private:
+  const std::string m_file;
+  const int m_line;
+  const std::string m_function;
+  const std::string m_message;
+
+ public:
+  friend
+  std::ostream& operator<<(std::ostream& os,
+                           const AssertError& assert_error)
+  {
+    os << '\n'
+       << rang::style::bold
+       << "*** Assertion error ***\n"
+       << " at " << assert_error.m_file << ':' << assert_error.m_line << '\n'
+       << " in " << assert_error.m_function << '\n'
+       << "*** " << rang::fgB::red << assert_error.m_message << rang::fg::reset
+       << rang::style::reset << '\n';
+
+    return os;
+  }
+
+  AssertError(const AssertError&) = default;
+  AssertError(std::string file,
+              int line,
+              std::string function,
+              std::string message)
+      : m_file(file),
+        m_line(line),
+        m_function(function),
+        m_message(message)
+  {
+    ;
+  }
+
+  ~AssertError() = default;
+};
+
+#define Assert(assertion)                                               \
+  if (not (assertion)) {                                                \
+    throw AssertError(__FILE__,                                         \
+                      __LINE__,                                         \
+                      __PRETTY_FUNCTION__,                              \
+                      (#assertion));                                    \
   }
 
 #endif // NDEBUG