Commit 6fc89548 authored by Graham MacDonald's avatar Graham MacDonald
Browse files

bump err-derive to 0.2 to stop __rt build error

parent 1fbd29a6
This diff is collapsed.
......@@ -59,7 +59,7 @@ path = "src/main.rs"
[dependencies]
calculate = { git = "https://gitlab.redox-os.org/redox-os/calc" }
err-derive = "0.1"
err-derive = "0.2"
glob = "0.3"
redox_liner = { git = "https://gitlab.redox-os.org/redox-os/liner" }
rand = "0.7"
......
......@@ -10,7 +10,7 @@ pub enum AssignmentError<'a> {
#[error(display = "expected {}, but received {}", _0, _1)]
InvalidValue(Primitive, Primitive),
#[error(display = "{}", _0)]
TypeError(#[error(cause)] TypeError),
TypeError(#[error(source)] TypeError),
#[error(
display = "extra values were supplied, and thus ignored. Previous assignment: '{}' = '{}'",
_0,
......
......@@ -37,7 +37,7 @@ pub enum MethodError {
/// An invalid regex was provided. This is specific to the `matches` method
#[error(display = "regex_replace: error in regular expression '{}': {}", _0, _1)]
InvalidRegex(String, #[error(cause)] regex::Error),
InvalidRegex(String, #[error(source)] regex::Error),
}
impl<'a, 'b, E: 'b + Expander> MethodArgs<'a, 'b, E> {
......
......@@ -30,13 +30,14 @@ use unicode_segmentation::UnicodeSegmentation;
/// Expansion errored
#[derive(Debug, Error)]
#[error(no_from)]
pub enum Error<T: fmt::Debug + error::Error + fmt::Display + 'static> {
/// Error during method expansion
#[error(display = "{}", _0)]
MethodError(#[error(cause)] MethodError),
MethodError(#[error(source)] MethodError),
/// Wrong type was given
#[error(display = "{}", _0)]
TypeError(#[error(cause)] TypeError),
TypeError(#[error(source)] TypeError),
/// Indexed out of the array bounds
#[error(display = "invalid index")] // TODO: Add more info
OutOfBound,
......@@ -49,7 +50,7 @@ pub enum Error<T: fmt::Debug + error::Error + fmt::Display + 'static> {
UnsupportedNamespace(String),
/// Failed to parse a value as an hexadecimal value
#[error(display = "could not parse '{}' as hexadecimal value: {}", _0, _1)]
InvalidHex(String, #[error(cause)] std::num::ParseIntError),
InvalidHex(String, #[error(source)] std::num::ParseIntError),
/// Could not parse as a valid color
#[error(display = "could not parse '{}' as a color", _0)]
ColorError(String),
......@@ -72,7 +73,7 @@ pub enum Error<T: fmt::Debug + error::Error + fmt::Display + 'static> {
/// Subprocess error
#[error(display = "Could not expand subprocess: {}", _0)]
Subprocess(#[error(cause)] Box<T>),
Subprocess(#[error(source)] Box<T>),
/// Could not parse the index for array or map-like variable
#[error(display = "Can't parse '{}' as a valid index for variable", _0)]
......
......@@ -13,6 +13,7 @@ const ARG_DEFAULT_SIZE: usize = 10;
/// An error produced during pipeline parsing
#[derive(Debug, PartialEq, Eq, Hash, Clone, Error)]
#[error(no_from)]
pub enum PipelineParsingError {
// redirections
/// No file was provided after the redirection output
......@@ -39,7 +40,7 @@ pub enum PipelineParsingError {
// paired
/// Error with paired tokens (parens, brackets & braces)
#[error(display = "{}", _0)]
Paired(#[error(cause)] LevelsError),
Paired(#[error(source)] LevelsError),
}
impl From<LevelsError> for PipelineParsingError {
......
......@@ -6,7 +6,7 @@ pub enum FunctionParseError {
#[error(display = "repeated argument name: '{}'", _0)]
RepeatedArgument(String),
#[error(display = "{}", _0)]
TypeError(#[error(cause)] TypeError),
TypeError(#[error(source)] TypeError),
}
/// The arguments expression given to a function declaration goes into here, which will be
......
......@@ -19,6 +19,7 @@ pub type Result<'a> = std::result::Result<Statement<'a>, Error>;
/// An Error occured during parsing
#[derive(Debug, Error, PartialEq, Eq, Hash, Clone)]
#[error(no_from)]
pub enum Error {
/// The command name is illegal
#[error(display = "illegal command name: {}", _0)]
......@@ -61,7 +62,7 @@ pub enum Error {
NoInKeyword,
/// Error with match statements
#[error(display = "case error: {}", _0)]
Case(#[error(cause)] CaseError),
Case(#[error(source)] CaseError),
/// The provided function name was invalid
#[error(
display = "'{}' is not a valid function name
......@@ -71,10 +72,10 @@ pub enum Error {
InvalidFunctionName(String),
/// The arguments did not match the function's signature
#[error(display = "function argument error: {}", _0)]
InvalidFunctionArgument(#[error(cause)] FunctionParseError),
InvalidFunctionArgument(#[error(source)] FunctionParseError),
/// Error occured during parsing of a pipeline
#[error(display = "{}", _0)]
Pipeline(#[error(cause)] PipelineParsingError),
Pipeline(#[error(source)] PipelineParsingError),
}
impl From<FunctionParseError> for Error {
......
......@@ -58,25 +58,26 @@ use std::{
/// Errors from execution
#[derive(Debug, Error)]
#[error(no_from)]
pub enum IonError {
// Parse-time error
/// Parsing failed
#[error(display = "syntax error: {}", _0)]
InvalidSyntax(#[error(cause)] ParseError),
InvalidSyntax(#[error(source)] ParseError),
/// Incorrect order of blocks
#[error(display = "block error: {}", _0)]
StatementFlowError(#[error(cause)] BlockError),
StatementFlowError(#[error(source)] BlockError),
// Run time errors
/// Function execution error
#[error(display = "function error: {}", _0)]
Function(#[error(cause)] FunctionError),
Function(#[error(source)] FunctionError),
/// Failed to run a pipeline
#[error(display = "pipeline execution error: {}", _0)]
PipelineExecutionError(#[error(cause)] PipelineError),
PipelineExecutionError(#[error(source)] PipelineError),
/// Could not properly expand to a pipeline
#[error(display = "expansion error: {}", _0)]
ExpansionError(#[error(cause)] ExpansionError<IonError>),
ExpansionError(#[error(source)] ExpansionError<IonError>),
}
impl From<ParseError> for IonError {
......
......@@ -40,52 +40,53 @@ use std::{
pub enum RedirectError {
/// Input
#[error(display = "failed to redirect '{}' to stdin: {}", _0, _1)]
File(String, #[error(cause)] io::Error),
File(String, #[error(source)] io::Error),
#[error(display = "failed to write herestring '{}': {}", _0, _1)]
WriteError(String, #[error(cause)] io::Error),
WriteError(String, #[error(source)] io::Error),
/// Output
#[error(display = "failed to redirect {} to file '{}': {}", redirect, file, why)]
Output {
redirect: RedirectFrom,
file: String,
#[error(cause)]
#[error(source)]
why: io::Error,
},
}
/// This is created when Ion fails to create a pipeline
#[derive(Debug, Error)]
#[error(no_from)]
pub enum PipelineError {
/// The fork failed
#[error(display = "failed to fork: {}", _0)]
Fork(#[error(cause)] nix::Error),
Fork(#[error(source)] nix::Error),
/// Failed to setup capturing for function
#[error(display = "error reading stdout of child: {}", _0)]
CaptureFailed(#[error(cause)] io::Error),
CaptureFailed(#[error(source)] io::Error),
/// Failed to duplicate a file descriptor
#[error(display = "could not duplicate the pipe: {}", _0)]
CloneFdFailed(#[error(cause)] nix::Error),
CloneFdFailed(#[error(source)] nix::Error),
/// Could not clone the file
#[error(display = "could not clone the pipe: {}", _0)]
ClonePipeFailed(#[error(cause)] io::Error),
ClonePipeFailed(#[error(source)] io::Error),
/// Could not set the pipe as a redirection
#[error(display = "{}", _0)]
RedirectPipeError(#[error(cause)] RedirectError),
RedirectPipeError(#[error(source)] RedirectError),
/// Failed to create a pipe
#[error(display = "could not create pipe: {}", _0)]
CreatePipeError(#[error(cause)] nix::Error),
CreatePipeError(#[error(source)] nix::Error),
/// Failed to create a fork
#[error(display = "could not fork: {}", _0)]
CreateForkError(#[error(cause)] nix::Error),
CreateForkError(#[error(source)] nix::Error),
/// Failed to terminate the jobs after a termination
#[error(display = "failed to terminate foreground jobs: {}", _0)]
TerminateJobsError(#[error(cause)] nix::Error),
TerminateJobsError(#[error(source)] nix::Error),
/// Could not execute the command
#[error(display = "command exec error: {}", _0)]
CommandExecError(#[error(cause)] io::Error, types::Args),
CommandExecError(#[error(source)] io::Error, types::Args),
/// Could not expand the alias
#[error(display = "unable to pipe outputs of alias: '{} = {}'", _0, _1)]
InvalidAlias(String, String),
......@@ -110,12 +111,12 @@ pub enum PipelineError {
/// Failed to grab the tty
#[error(display = "could not grab the terminal: {}", _0)]
TerminalGrabFailed(#[error(cause)] nix::Error),
TerminalGrabFailed(#[error(source)] nix::Error),
/// Failed to send signal to a process group. This typically happens when trying to start the
/// pipeline after it's creation
#[error(display = "could not kill the processes: {}", _0)]
KillFailed(#[error(cause)] nix::Error),
KillFailed(#[error(source)] nix::Error),
}
impl From<RedirectError> for PipelineError {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment