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 explicit ZrythmException (const QString &message);
25
26 const char * what () const noexcept;
27 utils::Utf8String what_string () const
28 {
30 }
31
32 template <typename... Args>
33 void handle (const std::string &format, Args &&... args) const;
34
35 void handle (const char * str) const;
36 void handle (const std::string &str) const;
37 void handle (const QString &str) const;
38
39private:
40 std::string message_;
41 mutable std::string full_message_;
42};
43
44} // 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