CatapultServer  v0.5.0.1 (Elephant)
exceptions.h File Reference
Include dependency graph for exceptions.h:

Go to the source code of this file.

Classes

class  catapult::catapult_error< TStlException >
 Base class for all catapult exceptions that derives from both std::exception and boost::exception. More...
 
class  catapult::catapult_error< catapult_error< TStlException > >
 
struct  catapult::ErrorParam1
 Tag for first custom exception parameter. More...
 
struct  catapult::ErrorParam2
 Tag for second custom exception parameter. More...
 
class  catapult::exception_detail::Make< TErrorParam >
 Helper class for creating boost::error_info. More...
 

Namespaces

 catapult
 
 catapult::exception_detail
 

Macros

#define VISIBLE_EXCEPTION_ATTRIBUTE   __attribute__ ((visibility ("default")))
 
#define CATAPULT_THROW_EXCEPTION(EXCEPTION)   BOOST_THROW_EXCEPTION(EXCEPTION)
 Macro used to throw a catapult exception. More...
 
#define CATAPULT_THROW_AND_LOG_0(TYPE, MESSAGE)
 Macro used to throw a catapult exception with zero parameters. More...
 
#define CATAPULT_THROW_AND_LOG_1(TYPE, MESSAGE, PARAM1)
 Macro used to throw a catapult exception with one parameter. More...
 
#define CATAPULT_THROW_AND_LOG_2(TYPE, MESSAGE, PARAM1, PARAM2)
 Macro used to throw a catapult exception with two parameters. More...
 
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)   CATAPULT_THROW_AND_LOG_0(catapult_runtime_error, MESSAGE)
 Macro used to throw a catapult runtime error. More...
 
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)   CATAPULT_THROW_AND_LOG_1(catapult_runtime_error, MESSAGE, PARAM1)
 Macro used to throw a catapult runtime error with a single parameter. More...
 
#define CATAPULT_THROW_RUNTIME_ERROR_2(MESSAGE, PARAM1, PARAM2)   CATAPULT_THROW_AND_LOG_2(catapult_runtime_error, MESSAGE, PARAM1, PARAM2)
 Macro used to throw a catapult runtime error with two parameters. More...
 
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)   CATAPULT_THROW_AND_LOG_0(catapult_invalid_argument, MESSAGE)
 Macro used to throw a catapult invalid argument. More...
 
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)   CATAPULT_THROW_AND_LOG_1(catapult_invalid_argument, MESSAGE, PARAM1)
 Macro used to throw a catapult invalid argument with a single parameter. More...
 
#define CATAPULT_THROW_INVALID_ARGUMENT_2(MESSAGE, PARAM1, PARAM2)   CATAPULT_THROW_AND_LOG_2(catapult_invalid_argument, MESSAGE, PARAM1, PARAM2)
 Macro used to throw a catapult invalid argument with two parameters. More...
 
#define CATAPULT_THROW_OUT_OF_RANGE(MESSAGE)   CATAPULT_THROW_AND_LOG_0(catapult_out_of_range, MESSAGE)
 Macro used to throw a catapult out of range. More...
 
#define CATAPULT_THROW_FILE_IO_ERROR(MESSAGE)   CATAPULT_THROW_AND_LOG_0(catapult_file_io_error, MESSAGE)
 Macro used to throw a catapult file io error. More...
 

Typedefs

using catapult::catapult_runtime_error = catapult_error< std::runtime_error >
 
using catapult::catapult_invalid_argument = catapult_error< std::invalid_argument >
 
using catapult::catapult_out_of_range = catapult_error< std::out_of_range >
 
using catapult::catapult_file_io_error = catapult_error< catapult_runtime_error >
 

Functions

template<typename T , typename X = std::enable_if_t<!std::is_pointer_v<T>>>
constexpr T catapult::exception_detail::ConvertToValue (const T &value)
 
template<typename TValue , typename TTag >
constexpr TValue catapult::exception_detail::ConvertToValue (const utils::BaseValue< TValue, TTag > &value)
 Converts value into a value that can be stored in a catapult exception. More...
 
template<typename T >
constexpr T catapult::exception_detail::ConvertToValue (const std::atomic< T > &value)
 Converts value into a value that can be stored in a catapult exception. More...
 
template<typename TInputIterator >
std::string catapult::exception_detail::ConvertToValue (const utils::ContainerHexFormatter< TInputIterator > &value)
 Converts value into a value that can be stored in a catapult exception. More...
 

Macro Definition Documentation

◆ CATAPULT_THROW_AND_LOG_0

#define CATAPULT_THROW_AND_LOG_0 (   TYPE,
  MESSAGE 
)
Value:
{ \
CATAPULT_LOG(error) << "Throwing exception: " << MESSAGE; \
CATAPULT_THROW_EXCEPTION(TYPE(MESSAGE)); \
}

Macro used to throw a catapult exception with zero parameters.

◆ CATAPULT_THROW_AND_LOG_1

#define CATAPULT_THROW_AND_LOG_1 (   TYPE,
  MESSAGE,
  PARAM1 
)
Value:
{ \
auto detail1 = exception_detail::Make<ErrorParam1>::From(PARAM1); \
CATAPULT_LOG(error) << "Throwing exception: " << MESSAGE << " (" << detail1.value() << ")"; \
CATAPULT_THROW_EXCEPTION(TYPE(MESSAGE) << detail1); \
}

Macro used to throw a catapult exception with one parameter.

◆ CATAPULT_THROW_AND_LOG_2

#define CATAPULT_THROW_AND_LOG_2 (   TYPE,
  MESSAGE,
  PARAM1,
  PARAM2 
)
Value:
{ \
auto detail1 = exception_detail::Make<ErrorParam1>::From(PARAM1); \
auto detail2 = exception_detail::Make<ErrorParam2>::From(PARAM2); \
CATAPULT_LOG(error) << "Throwing exception: " << MESSAGE << " (" << detail1.value() << ", " << detail2.value() << ")"; \
CATAPULT_THROW_EXCEPTION(TYPE(MESSAGE) << detail1 << detail2); \
}

Macro used to throw a catapult exception with two parameters.

◆ CATAPULT_THROW_EXCEPTION

#define CATAPULT_THROW_EXCEPTION (   EXCEPTION)    BOOST_THROW_EXCEPTION(EXCEPTION)

Macro used to throw a catapult exception.

◆ CATAPULT_THROW_FILE_IO_ERROR

#define CATAPULT_THROW_FILE_IO_ERROR (   MESSAGE)    CATAPULT_THROW_AND_LOG_0(catapult_file_io_error, MESSAGE)

Macro used to throw a catapult file io error.

◆ CATAPULT_THROW_INVALID_ARGUMENT

#define CATAPULT_THROW_INVALID_ARGUMENT (   MESSAGE)    CATAPULT_THROW_AND_LOG_0(catapult_invalid_argument, MESSAGE)

Macro used to throw a catapult invalid argument.

◆ CATAPULT_THROW_INVALID_ARGUMENT_1

#define CATAPULT_THROW_INVALID_ARGUMENT_1 (   MESSAGE,
  PARAM1 
)    CATAPULT_THROW_AND_LOG_1(catapult_invalid_argument, MESSAGE, PARAM1)

Macro used to throw a catapult invalid argument with a single parameter.

◆ CATAPULT_THROW_INVALID_ARGUMENT_2

#define CATAPULT_THROW_INVALID_ARGUMENT_2 (   MESSAGE,
  PARAM1,
  PARAM2 
)    CATAPULT_THROW_AND_LOG_2(catapult_invalid_argument, MESSAGE, PARAM1, PARAM2)

Macro used to throw a catapult invalid argument with two parameters.

◆ CATAPULT_THROW_OUT_OF_RANGE

#define CATAPULT_THROW_OUT_OF_RANGE (   MESSAGE)    CATAPULT_THROW_AND_LOG_0(catapult_out_of_range, MESSAGE)

Macro used to throw a catapult out of range.

◆ CATAPULT_THROW_RUNTIME_ERROR

#define CATAPULT_THROW_RUNTIME_ERROR (   MESSAGE)    CATAPULT_THROW_AND_LOG_0(catapult_runtime_error, MESSAGE)

Macro used to throw a catapult runtime error.

◆ CATAPULT_THROW_RUNTIME_ERROR_1

#define CATAPULT_THROW_RUNTIME_ERROR_1 (   MESSAGE,
  PARAM1 
)    CATAPULT_THROW_AND_LOG_1(catapult_runtime_error, MESSAGE, PARAM1)

Macro used to throw a catapult runtime error with a single parameter.

◆ CATAPULT_THROW_RUNTIME_ERROR_2

#define CATAPULT_THROW_RUNTIME_ERROR_2 (   MESSAGE,
  PARAM1,
  PARAM2 
)    CATAPULT_THROW_AND_LOG_2(catapult_runtime_error, MESSAGE, PARAM1, PARAM2)

Macro used to throw a catapult runtime error with two parameters.

◆ VISIBLE_EXCEPTION_ATTRIBUTE

#define VISIBLE_EXCEPTION_ATTRIBUTE   __attribute__ ((visibility ("default")))

Copyright (c) 2016-present, Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. All rights reserved.

This file is part of Catapult.

Catapult is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Catapult is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with Catapult. If not, see http://www.gnu.org/licenses/.