use crate::BlockId;
use crate::BlockTypeId;
use crate::InlineError;
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
pub enum StepError {
#[error("unknown block {0}")]
UnknownBlock(BlockId),
#[error("block {0} is not a text block")]
NotTextBlock(BlockId),
#[error("block {0} is not a container")]
NotContainer(BlockId),
#[error(transparent)]
Inline(#[from] InlineError),
#[error("block type {kind:?} is not allowed in {parent:?}")]
NotAllowed {
parent: Option<BlockId>,
kind: BlockTypeId,
},
#[error("content of block {0} does not match its type")]
ContentMismatch(BlockId),
#[error("block id {0} already exists")]
DuplicateId(BlockId),
#[error("child range {start}..{end} is out of bounds for {len} children")]
OutOfBounds {
start: usize,
end: usize,
len: usize,
},
#[error("block {next} does not directly follow {block}")]
NotAdjacent {
block: BlockId,
next: BlockId,
},
#[error("cannot move block {0} inside itself")]
MoveIntoSelf(BlockId),
#[error("block ids exhausted for this client")]
IdsExhausted,
}