Skip to content

Commit

Permalink
Added MessageError struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
SSheldon committed Dec 31, 2015
1 parent f7024cf commit 6a6d714
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/message/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::any::Any;
use std::error::Error;
use std::fmt;
use std::mem;

use runtime::{Class, Imp, Object, Sel, Super};
Expand Down Expand Up @@ -88,6 +90,21 @@ message_args_impl!(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J);
message_args_impl!(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K);
message_args_impl!(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L);

#[derive(Debug)]
pub struct MessageError(String);

impl fmt::Display for MessageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
}
}

impl Error for MessageError {
fn description(&self) -> &str {
&self.0
}
}

#[cfg(feature = "exception")]
macro_rules! objc_try {
($b:block) => (
Expand Down

0 comments on commit 6a6d714

Please sign in to comment.