-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* allow usage of cmn.rs for common types (like Error types) * instantiate an engine and handle errors, in an initial quick and dirty way. Fixes #52
- Loading branch information
Showing
4 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<%namespace name="util" file="../../lib/util.mako"/>\ | ||
<%! | ||
from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG, | ||
CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG) | ||
v_arg = '<%s>' % VALUE_ARG | ||
%>\ | ||
<%def name="new(c)">\ | ||
mod cmn; | ||
use cmn::{InvalidOptionsError, ArgumentError}; | ||
struct Engine { | ||
opts: Options, | ||
} | ||
impl Engine { | ||
fn new(options: Options) -> Result<Engine, InvalidOptionsError> { | ||
Ok(Engine { | ||
opts: options, | ||
}) | ||
} | ||
} | ||
</%def> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
#[derive(Debug)] | ||
pub enum ArgumentError { | ||
ConfigurationDirectoryInaccessible(String), | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct InvalidOptionsError { | ||
pub issues: Vec<ArgumentError>, | ||
pub exit_code: i32, | ||
} |