Skip to content

Commit eebe35f

Browse files
committed
feat: add ShapeError
1 parent 34dee9a commit eebe35f

File tree

3 files changed

+255
-207
lines changed

3 files changed

+255
-207
lines changed

src/error.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::fmt;
2+
3+
#[derive(Debug, Clone)]
4+
pub struct ShapeError {
5+
reason: String,
6+
}
7+
8+
impl ShapeError {
9+
pub fn new(reason: &str) -> Self {
10+
ShapeError {
11+
reason: reason.to_string(),
12+
}
13+
}
14+
}
15+
16+
impl fmt::Display for ShapeError {
17+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18+
write!(f, "ShapeError: {}", self.reason)
19+
}
20+
}

0 commit comments

Comments
 (0)