aboutsummaryrefslogtreecommitdiff
path: root/src/error
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-11-02 14:30:42 +0000
committerAkshay <[email protected]>2020-11-02 14:30:42 +0000
commit72789dff9c52cf2c5ef7772b301a1d5cfd90e272 (patch)
tree9adaee9dc9e999d1d571501435ce98b1b34eabd1 /src/error
parentd31097959f29d7b82dabfd050eb988a896c2e44b (diff)
fixes for nix
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}