Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
exceptions.h
1// SPDX-FileCopyrightText: © 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <exception>
7
8#include "utils/utf8_string.h"
9
14{
15
19class ZrythmException : public std::nested_exception
20{
21public:
22 explicit ZrythmException (const char * message);
23 explicit ZrythmException (const std::string &message);
24 ZrythmException (std::string_view message);
25 explicit ZrythmException (const QString &message);
26
27 const char * what () const noexcept;
28 utils::Utf8String what_string () const
29 {
31 }
32
33 template <typename... Args>
34 void handle (const std::string &format, Args &&... args) const;
35
36 void handle (const char * str) const;
37 void handle (const std::string &str) const;
38 void handle (const QString &str) const;
39
40private:
41 std::string message_;
42 mutable std::string full_message_;
43};
44
45} // namespace zrythm::utils::exceptions
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:38
static constexpr Utf8String from_utf8_encoded_string(std::string_view str)
Construct from a std::string_view that we are 100% sure is UTF8-encoded.
Definition utf8_string.h:81
Exception handling utilities.
Definition exceptions.h:14