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.1.23 src/exception.cpp
xot-0.1.22 src/exception.cpp
xot-0.1.21 src/exception.cpp
xot-0.1.20 src/exception.cpp
xot-0.1.19 src/exception.cpp
xot-0.1.16 src/exception.cpp
xot-0.1.15 src/exception.cpp
xot-0.1.14 src/exception.cpp
xot-0.1.13 src/exception.cpp
xot-0.1.12 src/exception.cpp
xot-0.1.11 src/exception.cpp
xot-0.1.10 src/exception.cpp
xot-0.1.9 src/exception.cpp
xot-0.1.8 src/exception.cpp
xot-0.1.7 src/exception.cpp