Browse Source

sen-native: better error reporting

Inderjit Gill 2 months ago
parent
commit
bae9ef3bc3
1 changed files with 11 additions and 10 deletions
  1. 11
    10
      native/sen-native/src/main.rs

+ 11
- 10
native/sen-native/src/main.rs View File

@@ -9,19 +9,19 @@ use std::io::Error as IoError;
9 9
 pub enum NativeError {
10 10
     GeneralError,
11 11
     NoneError,
12
-    IoError,
13
-    SenError,
12
+    IoError(IoError),
13
+    SenError(sen_core::error::Error),
14 14
 }
15 15
 
16 16
 impl From<IoError> for NativeError {
17
-    fn from(_e: IoError) -> NativeError {
18
-        NativeError::IoError
17
+    fn from(e: IoError) -> NativeError {
18
+        NativeError::IoError(e)
19 19
     }
20 20
 }
21 21
 
22 22
 impl From<sen_core::error::Error> for NativeError {
23
-    fn from(_e: sen_core::error::Error) -> NativeError {
24
-        NativeError::SenError
23
+    fn from(e: sen_core::error::Error) -> NativeError {
24
+        NativeError::SenError(e)
25 25
     }
26 26
 }
27 27
 
@@ -32,10 +32,11 @@ fn main() {
32 32
         .version("0.1.0")
33 33
         .author("Inderjit Gill <email@indy.io>")
34 34
         .about("native cli build of seni")
35
-        .arg(Arg::with_name("SCRIPT")
36
-             .help("Sets the input seni script to use")
37
-             .required(true)
38
-             .index(1))
35
+        .arg(
36
+            Arg::with_name("SCRIPT")
37
+                .help("Sets the input seni script to use")
38
+                .required(true)
39
+                .index(1))
39 40
         .arg(
40 41
             Arg::with_name("seed")
41 42
                 .short("s")