NoTeX
1.0.0
A modern noteworthy LaTeX template
Toggle main menu visibility
Loading...
Searching...
No Matches
notex
include
notex
errors.hpp
Go to the documentation of this file.
1
11
12
#pragma once
13
14
#include <stdexcept>
15
#include <string>
16
#include <utility>
17
18
namespace
notex
{
19
21
enum class
ExitCode
:
int
{
22
SUCCESS
= 0,
23
FAILURE
= 1,
24
USAGE_ERROR
= 2,
25
ENVIRONMENT_ERROR
= 3,
27
PROJECT_NOT_FOUND_ERROR
= 4,
28
FILESYSTEM_ERROR
= 5,
29
CONFIG_ERROR
= 6,
31
DOCUMENT_ERROR
= 7,
34
};
35
43
class
NotexError
:
public
std::runtime_error {
44
public
:
50
NotexError
(std::string message,
ExitCode
exit_code
)
51
: std::runtime_error(std::move(message)), exit_code_(
exit_code
) {}
52
54
ExitCode
exit_code
() const noexcept {
return
exit_code_; }
55
56
private
:
57
ExitCode
exit_code_;
58
};
59
61
class
UsageError :
public
NotexError
{
62
public
:
63
explicit
UsageError(std::string message)
64
:
NotexError
(std::move(message),
ExitCode::USAGE_ERROR
) {}
65
};
66
68
class
EnvironmentError :
public
NotexError
{
69
public
:
70
explicit
EnvironmentError(std::string message)
71
:
NotexError
(std::move(message),
ExitCode::ENVIRONMENT_ERROR
) {}
72
};
73
75
class
ProjectNotFoundError :
public
NotexError
{
76
public
:
77
explicit
ProjectNotFoundError(std::string message)
78
:
NotexError
(std::move(message),
ExitCode::PROJECT_NOT_FOUND_ERROR
) {}
79
};
80
82
class
FilesystemError :
public
NotexError
{
83
public
:
84
explicit
FilesystemError(std::string message)
85
:
NotexError
(std::move(message),
ExitCode::FILESYSTEM_ERROR
) {}
86
};
87
89
class
ConfigError :
public
NotexError
{
90
public
:
91
explicit
ConfigError(std::string message)
92
:
NotexError
(std::move(message),
ExitCode::CONFIG_ERROR
) {}
93
};
94
98
class
DocumentError :
public
NotexError
{
99
public
:
100
explicit
DocumentError(std::string message)
101
:
NotexError
(std::move(message),
ExitCode::DOCUMENT_ERROR
) {}
102
};
103
104
}
// namespace notex
notex::NotexError::exit_code
ExitCode exit_code() const noexcept
Definition
errors.hpp:54
notex::NotexError::NotexError
NotexError(std::string message, ExitCode exit_code)
Constructs an error with its message and exit code.
Definition
errors.hpp:50
notex
Definition
assets.hpp:20
notex::ExitCode
ExitCode
Process exit codes returned by the notex executable.
Definition
errors.hpp:21
notex::ExitCode::PROJECT_NOT_FOUND_ERROR
@ PROJECT_NOT_FOUND_ERROR
No .notex/ directory could be found.
Definition
errors.hpp:27
notex::ExitCode::FAILURE
@ FAILURE
An unexpected, unclassified error.
Definition
errors.hpp:23
notex::ExitCode::USAGE_ERROR
@ USAGE_ERROR
The command line was invalid.
Definition
errors.hpp:24
notex::ExitCode::DOCUMENT_ERROR
@ DOCUMENT_ERROR
Definition
errors.hpp:31
notex::ExitCode::FILESYSTEM_ERROR
@ FILESYSTEM_ERROR
A filesystem operation failed.
Definition
errors.hpp:28
notex::ExitCode::CONFIG_ERROR
@ CONFIG_ERROR
Definition
errors.hpp:29
notex::ExitCode::SUCCESS
@ SUCCESS
The command completed successfully.
Definition
errors.hpp:22
notex::ExitCode::ENVIRONMENT_ERROR
@ ENVIRONMENT_ERROR
Definition
errors.hpp:25
Generated by
1.17.0