#pragma once
#ifdef MANIFOLD_DEBUG
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
struct userErr : public virtual std::runtime_error {
using std::runtime_error::runtime_error;
};
struct topologyErr : public virtual std::runtime_error {
using std::runtime_error::runtime_error;
};
struct geometryErr : public virtual std::runtime_error {
using std::runtime_error::runtime_error;
};
using logicErr = std::logic_error;
template <typename Ex>
void AssertFail(const char* file, int line, const char* cond, const char* msg) {
std::ostringstream output;
output << "Error in file: " << file << " (" << line << "): \'" << cond
<< "\' is false: " << msg;
throw Ex(output.str());
}
template <typename Ex>
void AssertFail(const char* file, int line, const std::string& cond,
const std::string& msg) {
std::ostringstream output;
output << "Error in file: " << file << " (" << line << "): \'" << cond
<< "\' is false: " << msg;
throw Ex(output.str());
}
#define DEBUG_ASSERT …
#define ASSERT …
#else
#define DEBUG_ASSERT(condition, EX, msg) …
#define ASSERT(condition, EX) …
#endif