0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
util
error.h
Go to the documentation of this file.
1
/**
2
* @file src/util/error.h
3
*
4
* Copyright (c) 2021-2025 Bartek Kryza <bkryza@gmail.com>
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
#pragma once
19
20
#include <stdexcept>
21
22
#include "
common/model/enums.h
"
23
24
namespace
clanguml::error
{
25
26
class
query_driver_no_paths
:
public
std::runtime_error {
27
public
:
28
using
std::runtime_error::runtime_error;
29
};
30
31
struct
uml_alias_missing
:
public
std::runtime_error {
32
uml_alias_missing
(
const
std::string &message)
33
:
std
::runtime_error(message)
34
{
35
}
36
};
37
38
class
compilation_database_error
:
public
std::runtime_error {
39
public
:
40
using
std::runtime_error::runtime_error;
41
};
42
43
class
diagram_generation_error
:
public
std::runtime_error {
44
public
:
45
diagram_generation_error
(
common::model::diagram_t
type, std::string name,
46
std::string description)
47
:
std
::runtime_error{description}
48
,
type_
{type}
49
,
name_
{
std
::move(name)}
50
{
51
message_
=
52
fmt::format(
"Generation of {} diagram '{}' failed due to: {}"
,
53
diagram_type
(),
diagram_name
(), description);
54
}
55
56
const
char
*
what
() const noexcept
override
{
return
message_
.c_str(); }
57
58
const
std::string &
diagram_name
() const noexcept {
return
name_
; }
59
common::model::diagram_t
diagram_type
() const noexcept {
return
type_
; }
60
61
private
:
62
common::model::diagram_t
type_
;
63
std::string
name_
;
64
65
std::string
message_
;
66
};
67
68
class
empty_diagram_error
:
public
diagram_generation_error
{
69
using
diagram_generation_error::diagram_generation_error
;
70
};
71
72
class
invalid_sequence_from_condition
:
public
diagram_generation_error
{
73
using
diagram_generation_error::diagram_generation_error
;
74
};
75
76
class
invalid_sequence_to_condition
:
public
diagram_generation_error
{
77
using
diagram_generation_error::diagram_generation_error
;
78
};
79
80
}
// namespace clanguml::error
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7