AsmGrader
0.0.0
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
asmgrader/common/error_types.hpp
>
4
#include <
asmgrader/common/extra_formatters.hpp
>
5
6
#include <fmt/base.h>
7
#include <fmt/format.h>
8
9
#include <stdexcept>
10
#include <string>
11
12
namespace
asmgrader
{
13
15
class
ContextInternalError
:
public
std::runtime_error
16
{
17
public
:
18
using
std::runtime_error::runtime_error;
19
20
explicit
ContextInternalError
(ErrorKind error,
const
std::string& msg =
""
)
21
: std::runtime_error{msg}
22
, error_{error} {}
23
24
ErrorKind
get_error
()
const
{
return
error_; };
25
26
private
:
27
ErrorKind error_ = ErrorKind::UnknownError;
28
};
29
30
}
// namespace asmgrader
31
32
template
<>
33
struct
fmt::formatter<::
asmgrader::ContextInternalError
> :
::asmgrader::DebugFormatter
34
{
35
auto
format
(const ::asmgrader::ContextInternalError& from, format_context& ctx)
const
{
36
return
format_to(ctx.out(),
"{} : {}"
, from.what(), fmt::underlying(from.get_error()));
37
}
38
};
asmgrader::ContextInternalError
Error for any internal failure conditions of TestContext.
Definition
exceptions.hpp:16
asmgrader::ContextInternalError::ContextInternalError
ContextInternalError(ErrorKind error, const std::string &msg="")
Definition
exceptions.hpp:20
asmgrader::ContextInternalError::get_error
ErrorKind get_error() const
Definition
exceptions.hpp:24
error_types.hpp
extra_formatters.hpp
asmgrader
Definition
asm_buffer.hpp:19
asmgrader::DebugFormatter
Definition
debug.hpp:9
fmt::formatter<::asmgrader::ContextInternalError >::format
auto format(const ::asmgrader::ContextInternalError &from, format_context &ctx) const
Definition
exceptions.hpp:35
include
asmgrader
exceptions.hpp
Generated by
1.12.0