The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
AdventuresInLestoria/Crawler/Error.h

37 lines
893 B

#pragma once
#include <ostream>
#ifndef __EMSCRIPTEN__
#include <source_location>
#endif
#ifdef _DEBUG
#define NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the
// allocations to be of _CLIENT_BLOCK type
#else
#define NEW new
#endif
#undef ERR //Stupid Windows
#ifndef __EMSCRIPTEN__
#define ERR(err) { \
std::stringstream errStream; \
errStream<<err; \
Error::log(errStream,std::source_location::current());}
class Error{
public:
inline static void log(std::stringstream&str,std::source_location loc){
std::cout<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
throw;
}
};
#else
#define ERR(err) { \
std::stringstream errStream; \
errStream<<err; \
std::cout<<errStream.str(); }
#define _CrtDumpMemoryLeaks() ((int)0)
#endif