use serde_json::Error as JsonError;
use std::{fmt::Error as FmtError, io::Error as IoError, string::FromUtf8Error};
use thiserror::Error;
#[cfg(target_os = "windows")]
use widestring::error::Utf16Error;
#[cfg(target_os = "windows")]
use windows::{Win32::Foundation::WIN32_ERROR, core::Error as WindowsError};
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum LisaError {
#[error("A crate-wide logger has already been initialized!")]
AlreadyRegistered,
#[error("Host I/O error: {0:?}")]
IOError(#[from] IoError),
#[error("Error serializing JSON: {0:?}")]
JSONError(#[from] JsonError),
#[error("Formatting error: {0:?}")]
FormatError(#[from] FmtError),
#[error(
"Could not find a renderer that was compatible to render log lines, please file an issue."
)]
NoRendererFound,
#[error("Value is not an appropriate remap value: [{0}]")]
RemapError(String),
#[error("Error reading input in as UTF-8: {0:?}")]
UTF8(#[from] FromUtf8Error),
#[cfg(target_os = "windows")]
#[error("Underlying windows error: {0:?}")]
Windows(#[from] WindowsError),
#[cfg(target_os = "windows")]
#[error("Underlying Win32 Error: {0:?}")]
Win32(WIN32_ERROR),
#[cfg(target_os = "windows")]
#[error("Error converting Windows UTF16 string to UTF8 string.")]
UTF16ToUTF8Error(#[from] Utf16Error),
}