@@ -59,7 +59,9 @@ macro_rules! error_chain_processed {
59
59
pub state: $crate:: State ,
60
60
}
61
61
62
- impl_error!( $error_name $error_kind_name $( $link_error_path) * ) ;
62
+ impl_error!( $error_name
63
+ $error_kind_name
64
+ $( [ $link_error_path, $( #[ $meta_links] ) * ] ) * ) ;
63
65
64
66
impl $error_name {
65
67
/// Constructs an error from a kind.
@@ -300,7 +302,7 @@ macro_rules! error_chain {
300
302
macro_rules! impl_error {
301
303
( $error_name: ident
302
304
$error_kind_name: ident
303
- $( $link_error_path: path) * ) => {
305
+ $( [ $link_error_path: path, $ ( # [ $meta_links : meta ] ) * ] ) * ) => {
304
306
impl $error_name {
305
307
/// Returns the backtrace associated with this error.
306
308
pub fn backtrace( & self ) -> Option <& $crate:: Backtrace > {
@@ -321,16 +323,17 @@ macro_rules! impl_error {
321
323
fn extract_backtrace( e: & ( :: std:: error:: Error + Send + ' static ) )
322
324
-> Option <Option <:: std:: sync:: Arc <$crate:: Backtrace >>> {
323
325
if let Some ( e) = e. downcast_ref:: <$error_name>( ) {
324
- Some ( e. state. backtrace. clone( ) )
326
+ return Some ( e. state. backtrace. clone( ) ) ;
325
327
}
326
328
$(
327
- else if let Some ( e) = e. downcast_ref:: <$link_error_path>( ) {
328
- Some ( e. state. backtrace. clone( ) )
329
+ $( #[ $meta_links] ) *
330
+ {
331
+ if let Some ( e) = e. downcast_ref:: <$link_error_path>( ) {
332
+ return Some ( e. state. backtrace. clone( ) ) ;
333
+ }
329
334
}
330
335
) *
331
- else {
332
- None
333
- }
336
+ None
334
337
}
335
338
}
336
339
}
@@ -347,7 +350,7 @@ macro_rules! impl_error {
347
350
macro_rules! impl_error {
348
351
( $error_name: ident
349
352
$error_kind_name: ident
350
- $( $link_error_path: path) * ) => {
353
+ $( [ $link_error_path: path, $ ( # [ $meta_links : meta ] ) * ] ) * ) => {
351
354
impl $crate:: ChainedError for $error_name {
352
355
type ErrorKind = $error_kind_name;
353
356
0 commit comments