3rdparty
mcap
errors.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
5
namespace
mcap
{
6
10
enum class
StatusCode
{
11
Success
= 0,
12
NotOpen
,
13
InvalidSchemaId
,
14
InvalidChannelId
,
15
FileTooSmall
,
16
ReadFailed
,
17
MagicMismatch
,
18
InvalidFile
,
19
InvalidRecord
,
20
InvalidOpCode
,
21
InvalidChunkOffset
,
22
InvalidFooter
,
23
DecompressionFailed
,
24
DecompressionSizeMismatch
,
25
UnrecognizedCompression
,
26
OpenFailed
,
27
MissingStatistics
,
28
InvalidMessageReadOptions
,
29
NoMessageIndexesAvailable
,
30
};
31
35
struct
[[nodiscard]]
Status
{
36
StatusCode
code
;
37
std::string
message
;
38
39
Status
()
40
: code(
StatusCode
::
Success
) {}
41
42
Status
(
StatusCode
code)
43
: code(code) {
44
switch
(code) {
45
case
StatusCode::Success
:
46
break
;
47
case
StatusCode::NotOpen
:
48
message =
"not open"
;
49
break
;
50
case
StatusCode::InvalidSchemaId
:
51
message =
"invalid schema id"
;
52
break
;
53
case
StatusCode::InvalidChannelId
:
54
message =
"invalid channel id"
;
55
break
;
56
case
StatusCode::FileTooSmall
:
57
message =
"file too small"
;
58
break
;
59
case
StatusCode::ReadFailed
:
60
message =
"read failed"
;
61
break
;
62
case
StatusCode::MagicMismatch
:
63
message =
"magic mismatch"
;
64
break
;
65
case
StatusCode::InvalidFile
:
66
message =
"invalid file"
;
67
break
;
68
case
StatusCode::InvalidRecord
:
69
message =
"invalid record"
;
70
break
;
71
case
StatusCode::InvalidOpCode
:
72
message =
"invalid opcode"
;
73
break
;
74
case
StatusCode::InvalidChunkOffset
:
75
message =
"invalid chunk offset"
;
76
break
;
77
case
StatusCode::InvalidFooter
:
78
message =
"invalid footer"
;
79
break
;
80
case
StatusCode::DecompressionFailed
:
81
message =
"decompression failed"
;
82
break
;
83
case
StatusCode::DecompressionSizeMismatch
:
84
message =
"decompression size mismatch"
;
85
break
;
86
case
StatusCode::UnrecognizedCompression
:
87
message =
"unrecognized compression"
;
88
break
;
89
case
StatusCode::OpenFailed
:
90
message =
"open failed"
;
91
break
;
92
case
StatusCode::MissingStatistics
:
93
message =
"missing statistics"
;
94
break
;
95
case
StatusCode::InvalidMessageReadOptions
:
96
message =
"message read options conflict"
;
97
break
;
98
case
StatusCode::NoMessageIndexesAvailable
:
99
message =
"file has no message indices"
;
100
break
;
101
default
:
102
message =
"unknown"
;
103
break
;
104
}
105
}
106
107
Status
(
StatusCode
code,
const
std::string& message)
108
: code(code)
109
, message(message) {}
110
111
bool
ok
()
const
{
112
return
code ==
StatusCode::Success
;
113
}
114
};
115
116
}
// namespace mcap
mcap::Status::Status
Status(StatusCode code)
Definition:
errors.hpp:42
mcap::StatusCode::InvalidChunkOffset
@ InvalidChunkOffset
mcap::Status::message
std::string message
Definition:
errors.hpp:37
mcap::StatusCode::InvalidFooter
@ InvalidFooter
mcap::Status
Wraps a status code and string message carrying additional context.
Definition:
errors.hpp:35
mcap::StatusCode::DecompressionSizeMismatch
@ DecompressionSizeMismatch
mcap::StatusCode::NoMessageIndexesAvailable
@ NoMessageIndexesAvailable
mcap::StatusCode::InvalidMessageReadOptions
@ InvalidMessageReadOptions
mcap::StatusCode::ReadFailed
@ ReadFailed
mcap::Status::Status
Status()
Definition:
errors.hpp:39
mcap::StatusCode::OpenFailed
@ OpenFailed
mcap::StatusCode::NotOpen
@ NotOpen
mcap::StatusCode::MagicMismatch
@ MagicMismatch
mcap::StatusCode::DecompressionFailed
@ DecompressionFailed
mcap::Status::ok
bool ok() const
Definition:
errors.hpp:111
mcap
Definition:
crc32.hpp:5
mcap::StatusCode::Success
@ Success
mcap::Status::Status
Status(StatusCode code, const std::string &message)
Definition:
errors.hpp:107
mcap::StatusCode::InvalidFile
@ InvalidFile
mcap::StatusCode::InvalidRecord
@ InvalidRecord
mcap::StatusCode::FileTooSmall
@ FileTooSmall
mcap::StatusCode::UnrecognizedCompression
@ UnrecognizedCompression
mcap::Status::code
StatusCode code
Definition:
errors.hpp:36
mcap::StatusCode::InvalidOpCode
@ InvalidOpCode
mcap::StatusCode::InvalidChannelId
@ InvalidChannelId
mcap::StatusCode::InvalidSchemaId
@ InvalidSchemaId
mcap::StatusCode
StatusCode
Status codes for MCAP readers and writers.
Definition:
errors.hpp:10
mcap::StatusCode::MissingStatistics
@ MissingStatistics
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44