#![warn(missing_docs)]
use peg::{error::ParseError, str::LineCol};
use std::{
array::TryFromSliceError,
borrow::Cow,
num::{ParseIntError, TryFromIntError},
};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum MyError {
#[error("I/O error: {0}")]
IO(#[from] std::io::Error),
#[error("Date-Time error: {0}")]
Time(#[from] jiff::Error),
#[error("PEG error: {0:?}")]
Text(ParseError<LineCol>),
#[error("Json [Try]From error: {0}")]
Json(#[from] serde_json::Error),
#[error("Geos error: {0}")]
Geos(#[from] geos::Error),
#[error("Converting {0} to `f64` will result in loss of precision")]
PrecisionLoss(Cow<'static, str>),
#[error("CRS creation error: {0}")]
CRS(#[from] proj::ProjCreateError),
#[error("Proj error: {0}")]
Proj(#[from] proj::ProjError),
#[error("Runtime error: {0}")]
Runtime(Cow<'static, str>),
#[cfg(feature = "csv_ds")]
#[error("CSV error: {0}")]
CSV(#[from] csv::Error),
#[cfg(any(feature = "gpkg_ds", feature = "pg_ds"))]
#[error("SQLx error: {0}")]
SQL(#[from] sqlx::Error),
#[error("Conversion (bytes -> int) error: {0}")]
Conv(#[from] TryFromIntError),
#[error("Conversion (str -> int) error: {0}")]
Conv2(#[from] ParseIntError),
#[error("Conversion (slice) error: {0}")]
Slice(#[from] TryFromSliceError),
}