Skip to content

Commit 6a6d714

Browse files
committed
Added MessageError struct.
1 parent f7024cf commit 6a6d714

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/message/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use std::any::Any;
2+
use std::error::Error;
3+
use std::fmt;
24
use std::mem;
35

46
use runtime::{Class, Imp, Object, Sel, Super};
@@ -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);
8890
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);
8991
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);
9092

93+
#[derive(Debug)]
94+
pub struct MessageError(String);
95+
96+
impl fmt::Display for MessageError {
97+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
98+
fmt::Display::fmt(&self.0, f)
99+
}
100+
}
101+
102+
impl Error for MessageError {
103+
fn description(&self) -> &str {
104+
&self.0
105+
}
106+
}
107+
91108
#[cfg(feature = "exception")]
92109
macro_rules! objc_try {
93110
($b:block) => (

0 commit comments

Comments
 (0)