aboutsummaryrefslogtreecommitdiff
path: root/src/error
diff options
context:
space:
mode:
Diffstat (limited to 'src/error')
-rw-r--r--src/error/mod.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/error/mod.rs b/src/error/mod.rs
deleted file mode 100644
index ec2b555..0000000
--- a/src/error/mod.rs
+++ /dev/null
@@ -1,29 +0,0 @@
1/* Copyright (C) 2019 Akshay Oppiliappan <[email protected]>
2 * Refer to LICENCE for more information.
3 * */
4
5#[derive(Debug)]
6pub enum CalcError {
7 Math(Math),
8 Syntax(String),
9 Parser(String),
10}
11
12#[derive(Debug)]
13pub enum Math {
14 DivideByZero,
15 OutOfBounds,
16 UnknownBase,
17}
18
19pub fn handler(e: CalcError) -> String {
20 match e {
21 CalcError::Math(math_err) => match math_err {
22 Math::DivideByZero => "Math Error: Divide by zero error!".to_string(),
23 Math::OutOfBounds => "Domain Error: Out of bounds!".to_string(),
24 Math::UnknownBase => "Base too large! Accepted ranges: 0 - 36".to_string(),
25 },
26 CalcError::Syntax(details) => format!("Syntax Error: {}", details),
27 CalcError::Parser(details) => format!("Parser Error: {}", details),
28 }
29}