From 001c9917ace09f7b1c80d96eb067e1d37e86c546 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Fri, 27 Jun 2025 12:08:58 +0100 Subject: improve error handling --- nihil.ucl/errc.ccm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nihil.ucl/errc.ccm (limited to 'nihil.ucl/errc.ccm') diff --git a/nihil.ucl/errc.ccm b/nihil.ucl/errc.ccm new file mode 100644 index 0000000..8f0444d --- /dev/null +++ b/nihil.ucl/errc.ccm @@ -0,0 +1,33 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include +#include + +export module nihil.ucl:errc; + +namespace nihil::ucl { + +export enum struct errc { + no_error = 0, + + // ucl_object_new() or similar failed, e.g. out of memory + failed_to_create_object, + // Trying to create an object from a UCL object of the wrong type + type_mismatch, +}; + +export auto ucl_category() noexcept -> std::error_category &; +export auto make_error_condition(errc ec) -> std::error_condition; + +} // namespace nihil::ucl + +namespace std { + +export template<> +struct is_error_condition_enum : true_type {}; + +} // namespace std -- cgit v1.2.3