+/**
+ * @class source_location
+ * @brief Represents the location in the source code where an exception was thrown.
+ *
+ * The source_location class captures the file name, function name, and line number
+ * of the source code where an exception occurs. This information is useful for
+ * debugging and logging purposes.
+ *
+ * @details
+ * This class provides:
+ * - The name of the source file (file_name).
+ * - The name of the function (function_name).
+ * - The line number in the source file (line_number).
+ *
+ * Example usage:
+ * @code
+ * try {
+ * // Code that may throw an exception.
+ * } catch (const lttng::runtime_error& ex) {
+ * // Handle the exception, possibly logging location information.
+ * ERR_FMT("{} [{}]", ex.what(), ex.source_location);
+ * }
+ * @endcode
+ */
+class source_location {
+public:
+ source_location(lttng::c_string_view file_name_,
+ lttng::c_string_view function_name_,
+ unsigned int line_number_) :
+ file_name(file_name_), function_name(function_name_), line_number(line_number_)
+ {
+ }
+
+ lttng::c_string_view file_name;
+ lttng::c_string_view function_name;
+ unsigned int line_number;
+};
+
+/**
+ * @class runtime_error
+ * @brief Base type for all LTTng exceptions.
+ *
+ * Exceptions in the project provide an error message (through the usual what() method), but that
+ * message may not include the whole context of the error. For example, it is not always desirable
+ * to include the source location in a user-facing message.
+ *
+ * As such, exception handlers should mind the type of the exception being thrown and consider
+ * what context is suitable to extract (e.g. some context may only be relevant at the DEBUG logging
+ * level, while the error message may be user-facing).
+ *
+ * Since 'what()' is marked as noexcept, derived classes should format their generic message during
+ * their construction and pass it to the runtime_error constructor.
+ */