From fd821a5eada1f6d01ccd07d614c8dd8042fdacdd Mon Sep 17 00:00:00 2001 From: Michael Bryan Date: Sun, 25 Jun 2017 00:13:41 +0800 Subject: [PATCH] the binary now uses error-chain --- src/bin/mdbook.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/mdbook.rs b/src/bin/mdbook.rs index 71184e6f..e48f8e66 100644 --- a/src/bin/mdbook.rs +++ b/src/bin/mdbook.rs @@ -14,10 +14,10 @@ extern crate time; extern crate crossbeam; use std::env; -use std::error::Error; use std::ffi::OsStr; use std::io::{self, Write}; use std::path::{Path, PathBuf}; +use mdbook::errors::*; use clap::{App, ArgMatches, SubCommand, AppSettings}; @@ -110,7 +110,7 @@ fn confirm() -> bool { // Init command implementation -fn init(args: &ArgMatches) -> Result<(), Box> { +fn init(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); let mut book = MDBook::new(&book_dir); @@ -163,7 +163,7 @@ fn init(args: &ArgMatches) -> Result<(), Box> { // Build command implementation -fn build(args: &ArgMatches) -> Result<(), Box> { +fn build(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); let book = MDBook::new(&book_dir).read_config()?; @@ -194,7 +194,7 @@ fn build(args: &ArgMatches) -> Result<(), Box> { // Watch command implementation #[cfg(feature = "watch")] -fn watch(args: &ArgMatches) -> Result<(), Box> { +fn watch(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); let book = MDBook::new(&book_dir).read_config()?; @@ -233,7 +233,7 @@ mod serve { use std; use std::path::Path; - use std::error::Error; + use mdbook::errors::*; use self::iron::{Iron, AfterMiddleware, IronResult, IronError, Request, Response, status, Set, Chain}; use clap::ArgMatches; use mdbook::MDBook; @@ -253,7 +253,7 @@ mod serve { } // Watch command implementation - pub fn serve(args: &ArgMatches) -> Result<(), Box> { + pub fn serve(args: &ArgMatches) -> Result<()> { const RELOAD_COMMAND: &'static str = "reload"; let book_dir = get_book_dir(args); @@ -334,7 +334,7 @@ mod serve { } } -fn test(args: &ArgMatches) -> Result<(), Box> { +fn test(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); let mut book = MDBook::new(&book_dir).read_config()?;