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
13
namespace
zrythm::utils::exceptions
14
{
15
19
class
ZrythmException :
public
std::nested_exception
20
{
21
public
:
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
{
29
return
utils::Utf8String::from_utf8_encoded_string
(what ());
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
39
private
:
40
std::string message_;
41
mutable
std::string full_message_;
42
};
43
44
}
// namespace zrythm::utils::exceptions
zrythm::utils::Utf8String
Lightweight UTF-8 string wrapper with safe conversions.
Definition
utf8_string.h:38
zrythm::utils::Utf8String::from_utf8_encoded_string
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
zrythm::utils::exceptions
Exception handling utilities.
Definition
exceptions.h:14
src
utils
exceptions.h
Generated by
1.15.0