Skip to main content

erosbag_core/
error.rs

1use crate::identifier::ChannelId;
2use crate::ros_messages::RosMessageType;
3use crate::{ChannelTopic, ChunkId, FileName};
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum Error {
8    #[error(transparent)]
9    BagFileError(#[from] crate::bagfile::error::BagFileError),
10
11    #[error(transparent)]
12    EcoordError(#[from] ecoord::Error),
13    #[error(transparent)]
14    EpointError(#[from] epoint::Error),
15    #[error(transparent)]
16    EpointTransformError(#[from] epoint::transform::Error),
17    #[error(transparent)]
18    EimageError(#[from] eimage::Error),
19
20    #[error(transparent)]
21    StdIoError(#[from] std::io::Error),
22    #[error(transparent)]
23    CdrError(#[from] cdr::Error),
24    #[error(transparent)]
25    McapError(#[from] mcap::McapError),
26
27    #[error("Invalid combinations of open options")]
28    InvalidInput,
29
30    #[error("path is not a directory")]
31    RosbagPathIsNoDirectory,
32
33    #[error("path is not a directory")]
34    ContainsNoRosbagFile,
35
36    #[error("directory path contains no mcap file")]
37    ContainsNoMcapFile,
38    #[error("MCAP contains no file with name `{0}`")]
39    ContainsNoMcapFileWithName(FileName),
40    #[error("channel with topic `{0}` does not exist")]
41    ChannelWithTopicDoesNotExist(ChannelTopic),
42    #[error("channel with id `{0}` does not exist")]
43    ChannelWithIdDoesNotExist(ChannelId),
44    #[error("channel with id `{0}` does not have a schema")]
45    ChannelWithoutSchema(ChannelTopic),
46    #[error("channel with id `{0}` has the schema `{1}`")]
47    ChannelWithInvalidSchema(ChannelTopic, String),
48    #[error("channel with name `{0}` exists multiple times")]
49    MultipleChannelsWithNameExist(String),
50
51    #[error("chunk with id `{0}` not found")]
52    ChunkIdNotFound(ChunkId),
53
54    #[error("channel with id `{0}` does not hold messages of type `{1}`")]
55    ChannelDoesNotHold(ChannelTopic, RosMessageType),
56
57    #[error("multiple bagfiles are currently not supported by erosbag")]
58    MultipleBagfilesNotSupported,
59}