#pragma once
#include "Deer/Log.h"
#include "angelscript.h"

namespace Deer {
	namespace EditorEngine {
		const char* getAngelScriptReturnCodeString(int code);
	}
}

#define AS_CHECK(f)  { \
 int __r = f;	\
 if (__r < 0) {                        \
	 DEER_UI_ENGINE_ERROR("Error at line: {0}:{1} -> {2}", __FILE__, __LINE__, Deer::EditorEngine::getAngelScriptReturnCodeString(__r)); \
 }       \
}
#define AS_CHECK_ADDITIONAL_INFO(f, i)  { \
	int __r = f;	\
	if (__r < 0) {                        \
		DEER_UI_ENGINE_ERROR("Error at line: {0}:{1} -> {2} \n {3}", __FILE__, __LINE__, Deer::EditorEngine::getAngelScriptReturnCodeString(__r), i); \
	}       \
   }
#define AS_RET_CHECK(f)  { \
	int __r = f;	\
	if (__r < 0) {                        \
		DEER_UI_ENGINE_ERROR("Error at line: {0}:{1} -> {2}", __FILE__, __LINE__, Deer::EditorEngine::getAngelScriptReturnCodeString(__r)); \
		return; \
	}       \
}


