|
|
@@ -14,11 +14,11 @@ pub fn parse(message: &str) -> Command {
|
|
14
|
14
|
Command::Control(cmd.to_string())
|
|
15
|
15
|
}
|
|
16
|
16
|
Some("RETRIEVE") => { Command::Retrieve }
|
|
17
|
|
- Some(_) => { Command::NotFoundError }
|
|
18
|
|
- None => { Command::EmptyError }
|
|
|
17
|
+ Some(_) => { Command::Error(ParseError::UnknownCommand) }
|
|
|
18
|
+ None => { Command::Error(ParseError::EmptyString) }
|
|
19
|
19
|
}
|
|
20
|
20
|
}
|
|
21
|
|
- None => { Command::EmptyError }
|
|
|
21
|
+ None => { Command::Error(ParseError::EmptyString) }
|
|
22
|
22
|
}
|
|
23
|
23
|
}
|
|
24
|
24
|
|
|
|
@@ -27,6 +27,11 @@ pub enum Command {
|
|
27
|
27
|
Stage(String),
|
|
28
|
28
|
Control(String),
|
|
29
|
29
|
Retrieve,
|
|
30
|
|
- NotFoundError,
|
|
31
|
|
- EmptyError,
|
|
|
30
|
+ Error(ParseError),
|
|
|
31
|
+}
|
|
|
32
|
+
|
|
|
33
|
+#[derive(Debug, PartialEq)]
|
|
|
34
|
+pub enum ParseError {
|
|
|
35
|
+ UnknownCommand,
|
|
|
36
|
+ EmptyString,
|
|
32
|
37
|
}
|