#pragma once



#include "define.h"
#include "windowsAPI.h"
#include "bugreport.h"
#include "namespace_start.h"

class Exception:public std::runtime_error{
		
	private:
		NString  errMessage;
		UInt line;
		NString fileName;
		NString function;
		HRESULT osErrorCode;
		
	public:
		///
		///コンストラクタ
		///
		Exception(const NString&  errMessage,UInt in_line,const NString &in_fileName,const NString &in_function,HRESULT hResult  = GetLastError());
		
		
		///
		///エラー文言取得
		///
		const NString &GetErrorMessage()const;


		///
		///エラー発生行取得
		///
		UInt getLineNo()const;

		///
		///エラー発生ファイル名取得
		///
		const NString &getFileName()const;


		///
		///エラー発生関数名を取得
		///
		const NString &getFunctionName()const;


		///
		///バグ報告関数
		///
		Bool Report();

	};



#define THROW_EXCEPTION(E,M) throw E(M,__LINE__,_T(__FILE__),_T(__FUNCTION__))

#define THROW_HRESULTEXCEPTION() THROW_EXCEPTION(Exception,_T("HResult例外値が発生しました"))

#define CHECK_HRESULT(r) if(r.IsFailed())THROW_HRESULTEXCEPTION()

#include "namespace_end.h"