kerbalobjects/errors.rs
1//! Generic errors while reading KSM or KO files
2use thiserror::Error;
3
4/// An error type that describes an error while just parsing a KOSValue
5#[derive(Debug, Error, Copy, Clone)]
6pub enum KOSValueParseError {
7 /// Error running out of bytes while reading KOSValue
8 #[error("EOF reached while parsing KOSValue")]
9 EOF,
10 /// Error reading invalid KOSValue type
11 #[error("Invalid KOSValue type: {0}")]
12 InvalidType(u8),
13}
14
15/// An error type that describes an error while just parsing an Opcode
16#[derive(Debug, Error, Copy, Clone)]
17pub enum OpcodeParseError {
18 /// Error running out of bytes while reading instruction opcode
19 #[error("EOF reached while parsing opcode")]
20 EOF,
21 /// Error reading invalid instruction opcode
22 #[error("Invalid opcode: {0}")]
23 InvalidOpcode(u8),
24}