1use alloc::string::String;
2use core::str::Utf8Error;
3
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum BuildAttrError {
8 #[error("no data")]
9 NoData,
10 #[error("incompatible format version")]
11 IncompatibleVersion(u8),
12}
13
14#[derive(Error, Debug)]
15pub enum ReadError {
16 #[error("UTF8 error")]
17 Utf8(Utf8Error),
18 #[error("no more data (EOF reached)")]
19 Eof,
20 #[error("index out of bounds")]
21 OutOfBounds,
22}
23
24#[derive(Error, Debug)]
25pub enum PublicAttrsError {
26 #[error("invalid subsection name, should be 'aeabi'")]
27 InvalidName(String),
28 #[error("tag error")]
29 Tag(TagError),
30 #[error("no tags")]
31 NoTags,
32 #[error("expected first tag to be a file tag")]
33 NoFileTag,
34 #[error("duplicate file tag")]
35 DuplicateFileTag,
36 #[error("expected to be in file scope")]
37 NotFileScope,
38 #[error("expected to be in section scope")]
39 NotSectionScope,
40 #[error("enclosed scope ends before parent scope")]
41 ScopeEndsBeforeParent,
42}
43
44#[derive(Error, Debug)]
45pub enum TagError {
46 #[error("incompatible tag value")]
47 IncompatibleTagValue(u8),
48 #[error("read error")]
49 Read(ReadError),
50 #[error("invalid scope tag")]
51 InvalidScopeTag,
52 #[error("expected null")]
53 ExpectedNull,
54 #[error("nested scope tag")]
55 NestedScopeTag,
56}