From 431e9b8cd0322576c7627d8f4e9e1c947b991603 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 9 May 2014 10:21:36 -0700 Subject: [PATCH] Mark errors as deprecated --- src/cargo/core/errors.rs | 32 ++------------------------------ src/cargo/util/result.rs | 5 +++++ 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/src/cargo/core/errors.rs b/src/cargo/core/errors.rs index 9a1d27408..2f8517f26 100644 --- a/src/cargo/core/errors.rs +++ b/src/cargo/core/errors.rs @@ -2,36 +2,8 @@ use std::fmt; use std::fmt::{Show,Formatter}; use std::io::IoError; -/** - * There are two kinds of errors returned by Cargo functions: - * - * * CargoCLIError, which represents a failure that can be directly presented - * to the user. - * * CargoInternalError, which represents an internal failure that must be - * converted into a CargoCLIError before it may be presented to the user. - * - * These two kinds of errors are wrapped up in a `CargoError` enum. - * - * Cargo functions must first convert all other kinds of errors (such as - * IoError) into one of the Cargo errors before returning. - * - * This module includes several convenience functions for working with these - * different kinds of errors: - * - * `to_result::(|E1| -> E2) -> E2` converts any kind of error into - * another kind of error. It can be used together with `try!`, as in: - * - * try!(mkdir(path).to_result(|err| { - * let msg = format!("Couldn't make directory {}", path.display()); - * CargoError::cli(msg, 12) - * }) - * - * `to_result::, E>(|| -> E) -> E` converts a `None` value into - * another kind of error. It can also be used together with `try!`: - * - * try!(from_str(val).to_result(|| { - * CargoError::internal(StringConversionError(val)) - * }) +/* + * Deprecated and will be phased out. Use util::result instead */ pub type CargoResult = Result; diff --git a/src/cargo/util/result.rs b/src/cargo/util/result.rs index 1bf9072df..5a3823ebe 100644 --- a/src/cargo/util/result.rs +++ b/src/cargo/util/result.rs @@ -1,5 +1,10 @@ use std::io; +/* + * CargoResult should be used in libcargo. CargoCliResult should be used in the + * various executables. + */ + pub type CargoResult = Result; pub fn other_error(desc: &'static str) -> CargoError { -- 2.39.5