Sha256: f63d97efe76cbfdb999c16a66d5c80773e99749bd275b9c445be72abc0e7c7ef

Contents?: true

Size: 1.53 KB

Versions: 35

Compression:

Stored size: 1.53 KB

Contents

#include "xot/exception.h"


namespace Xot
{


	XotError::XotError (const char* str)
	:	Super(str ? str : "")
	{
	}


	InvalidStateError::InvalidStateError (const char* str)
	:	Super(str)
	{
	}


	SystemError::SystemError (const char* str)
	:	Super(str)
	{
	}


	NotImplementedError::NotImplementedError (const char* str)
	:	Super(str)
	{
	}


	String
	error_text (const char* file, int line, const char* str)
	{
		String s = str;
		if (file) s = stringf("%s:%d: ", file, line) + s;
		return s;
	}


	namespace ErrorFunctions
	{

		void
		xot_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw XotError(error_text(file, line, s));
		}

		void
		argument_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw std::invalid_argument(error_text(file, line, s));
		}

		void
		index_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw std::out_of_range(error_text(file, line, s));
		}

		void
		invalid_state_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw InvalidStateError(error_text(file, line, s));
		}

		void
		system_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw SystemError(error_text(file, line, s));
		}

		void
		not_implemented_error (const char* file, int line, const char* format, ...)
		{
			XOT_STRINGF(format, s);
			throw NotImplementedError(error_text(file, line, s));
		}

	}// ErrorFunctions


}// Xot

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
xot-0.2 src/exception.cpp
xot-0.1.42 src/exception.cpp
xot-0.1.41 src/exception.cpp
xot-0.1.40 src/exception.cpp
xot-0.1.39 src/exception.cpp
xot-0.1.38 src/exception.cpp
xot-0.1.37 src/exception.cpp
xot-0.1.36 src/exception.cpp
xot-0.1.35 src/exception.cpp
xot-0.1.34 src/exception.cpp
xot-0.1.33 src/exception.cpp
xot-0.1.32 src/exception.cpp
xot-0.1.31 src/exception.cpp
xot-0.1.30 src/exception.cpp
xot-0.1.29 src/exception.cpp
xot-0.1.28 src/exception.cpp
xot-0.1.27 src/exception.cpp
xot-0.1.26 src/exception.cpp
xot-0.1.25 src/exception.cpp
xot-0.1.24 src/exception.cpp