Skip to content

Commit 7367d39

Browse files
committed
drop thiserror
1 parent e20a859 commit 7367d39

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

Cargo.lock

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ lto = "fat"
2020
codegen-units=1
2121

2222
[dependencies]
23-
thiserror = "1.0"
2423
libc = "0.2.155"
2524
streaming-iterator = "0.1.5"
2625
serde = {version = "1.0.203", features = ["derive"], optional = true}

src/sys/mod.rs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use thiserror::Error;
2-
31
mod macros;
42

53
#[allow(dead_code)]
@@ -47,52 +45,73 @@ pub use treeseq::TreeSequence;
4745

4846
use traits::TskTeardown;
4947

50-
#[derive(Error, Debug)]
5148
#[non_exhaustive]
49+
#[derive(Debug)]
5250
pub enum TskitError {
5351
/// Returned when conversion attempts fail
54-
#[error("range error: {}", *.0)]
52+
//#[error("range error: {}", *.0)]
5553
RangeError(String),
5654
/// Used when bad input is encountered.
57-
#[error("we received {} but expected {}",*got, *expected)]
55+
//#[error("we received {} but expected {}",*got, *expected)]
5856
ValueError { got: String, expected: String },
5957
/// Used when array access is out of range.
6058
/// Typically, this is used when accessing
6159
/// arrays allocated on the C side.
62-
#[error("Invalid index")]
60+
//#[error("Invalid index")]
6361
IndexError,
6462
/// Raised when samples are requested from
6563
/// [`crate::Tree`] objects, but sample lists are
6664
/// not being updated.
67-
#[error("Not tracking samples in Trees")]
65+
//#[error("Not tracking samples in Trees")]
6866
NotTrackingSamples,
6967
/// Wrapper around tskit C API error codes.
70-
#[error("{}", get_tskit_error_message(*code))]
68+
//#[error("{}", get_tskit_error_message(*code))]
7169
ErrorCode { code: i32 },
7270
/// A redirection of [``crate::metadata::MetadataError``]
73-
#[error("{value:?}")]
71+
//#[error("{value:?}")]
7472
MetadataError {
7573
/// The redirected error
76-
#[from]
74+
// #[from]
7775
value: MetadataError,
7876
},
7977
/// General error variant
80-
#[error("{}", *.0)]
78+
//#[error("{}", *.0)]
8179
LibraryError(String),
8280
}
8381

84-
#[derive(Error, Debug)]
82+
impl std::fmt::Display for TskitError {
83+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
84+
todo!()
85+
}
86+
}
87+
88+
impl From<MetadataError> for TskitError {
89+
fn from(value: MetadataError) -> Self {
90+
Self::MetadataError { value }
91+
}
92+
}
93+
94+
impl std::error::Error for TskitError {}
95+
96+
#[derive(Debug)]
8597
#[non_exhaustive]
8698
pub enum MetadataError {
8799
/// Error related to types implementing
88100
/// metadata serialization.
89-
#[error("{}", *value)]
101+
// #[error("{}", *value)]
90102
RoundtripError {
91-
#[from]
92103
value: Box<dyn std::error::Error + Send + Sync>,
93104
},
94105
}
95106

107+
impl std::fmt::Display for MetadataError {
108+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
109+
todo!()
110+
}
111+
}
112+
113+
impl std::error::Error for MetadataError {}
114+
96115
//#[non_exhaustive]
97116
//#[derive(Error, Debug)]
98117
//pub enum Error {

0 commit comments

Comments
 (0)