Skip to content

Commit

Permalink
Replace CommandError with an alias to Box<dyn Error> (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
arqunis committed May 29, 2020
1 parent 5340bc2 commit a406d48
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/framework/standard/structures/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
collections::HashSet,
fmt,
error::Error as StdError,
};
use crate::client::Context;
use crate::model::{
Expand Down Expand Up @@ -67,16 +68,7 @@ pub struct CommandOptions {
pub sub_commands: &'static [&'static Command],
}

#[derive(Debug, Clone)]
pub struct CommandError(pub String);

impl<T: fmt::Display> From<T> for CommandError {
#[inline]
fn from(d: T) -> Self {
CommandError(d.to_string())
}
}

pub type CommandError = Box<dyn StdError>;
pub type CommandResult = ::std::result::Result<(), CommandError>;

pub type CommandFn = fn(&Context, &Message, Args) -> CommandResult;
Expand Down

0 comments on commit a406d48

Please sign in to comment.