throw_handlerļƒ

The throw_handler simply throws a ztd::text::encoding_error as an exception. This should only EVER be used for pre-verified, trusted input sources, debugging purposes, or similar; malformed text is a common enough occurrence that throwing errors by default or using this handler by default is a bad idea in almost every way.

Throwing on encoding, decoding, and other errors can easily result in Denial of Service target points if this is used in conjunction with user or untrusted input sources.

constexpr throw_handler_t ztd::text::throw_handler = {}ļƒ

An instance of throw_handler_t for ease of use.

class throw_handler_tļƒ

An error handler that throws on any encode operation failure.

Remark

This class absolutely should not be used unless the user is prepared to handle spurious failure, especially for text processing that deals with input vectors. This can result in many exceptions being thrown, which for resource-intensive applications could cause issues and result in Denial of Service by way of repeated, unhandled, and unexpected failure.

Public Functions

template<typename _Encoding, typename _Input, typename _Output, typename _State, typename _InputProgress, typename _OutputProgress>
inline constexpr encode_result<_Input, _Output, _State> operator()(const _Encoding&, encode_result<_Input, _Output, _State> __result, const _InputProgress&, const _OutputProgress&) const noexcept(false)ļƒ

Throws a ztd::text::encoding_error as an exception on an encode failure.

template<typename _Encoding, typename _Input, typename _Output, typename _State, typename _InputProgress, typename _OutputProgress>
inline constexpr decode_result<_Input, _Output, _State> operator()(const _Encoding&, decode_result<_Input, _Output, _State> __result, const _InputProgress&, const _OutputProgress&) const noexcept(false)ļƒ

Throws a ztd::text::encoding_error code as an exception on a decode failure.