aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/error/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/error/mod.rs b/src/error/mod.rs
index 14153fe..a269555 100644
--- a/src/error/mod.rs
+++ b/src/error/mod.rs
@@ -11,19 +11,19 @@ pub enum Math {
11 OutOfBounds, 11 OutOfBounds,
12} 12}
13 13
14pub fn handler(e: CalcError) { 14pub fn handler(e: CalcError) -> String {
15 match e { 15 match e {
16 CalcError::Math(math_err) => { 16 CalcError::Math(math_err) => {
17 match math_err { 17 match math_err {
18 Math::DivideByZero => println!("Math Error: Divide by zero error!"), 18 Math::DivideByZero => format!("Math Error: Divide by zero error!"),
19 Math::OutOfBounds => println!("Domain Error: Out of bounds!") 19 Math::OutOfBounds => format!("Domain Error: Out of bounds!")
20 } 20 }
21 }, 21 },
22 CalcError::Syntax(details) => { 22 CalcError::Syntax(details) => {
23 println!("Syntax Error: {}", details); 23 format!("Syntax Error: {}", details)
24 }, 24 },
25 CalcError::Parser(details) => { 25 CalcError::Parser(details) => {
26 println!("Parser Error: {}", details); 26 format!("Parser Error: {}", details)
27 } 27 }
28 } 28 }
29} 29}