unreal_helpers/
error.rs

1//! Error type
2
3use std::{
4    io,
5    string::{FromUtf16Error, FromUtf8Error},
6};
7
8use thiserror::Error;
9
10/// Gets thrown when there is an error reading/writing an FString.
11#[derive(Error, Debug)]
12pub enum FStringError {
13    /// String has invalid size
14    #[error("Invalid string size {0} at position {1}")]
15    InvalidStringSize(i32, u64),
16    /// String has invalid terminator
17    #[error("Invalid string terminator {0} at position {1}")]
18    InvalidStringTerminator(u16, u64),
19    /// String is not in the expected UTF-8 format
20    #[error("Utf8 Error {0}")]
21    Utf8(#[from] FromUtf8Error),
22    /// String is not in the expected UTF-16 format
23    #[error("Utf16 Error {0}")]
24    Utf16(#[from] FromUtf16Error),
25    /// Io Error
26    #[error("Io Error {0}")]
27    Io(#[from] io::Error),
28}