File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -319,3 +319,35 @@ macro_rules! blame_err {
319
319
} )
320
320
} ;
321
321
}
322
+
323
+ /// This macro is identical to [`blame_err!`], except it will simply return a
324
+ /// [`GenericErrorWithCause`], not `return`ing it from the caller function. This
325
+ /// is more useful if you're providing a blamed error to something like
326
+ /// `.map_err()`.
327
+ #[ macro_export]
328
+ macro_rules! make_blamed_err {
329
+ ( client, $err: expr) => {
330
+ :: perseus:: GenericErrorWithCause {
331
+ error: $err. into( ) ,
332
+ cause: $crate:: ErrorCause :: Client ( :: std:: option:: Option :: None ) ,
333
+ }
334
+ } ;
335
+ ( client, $code: literal, $err: expr) => {
336
+ :: perseus:: GenericErrorWithCause {
337
+ error: $err. into( ) ,
338
+ cause: $crate:: ErrorCause :: Client ( :: std:: option:: Option :: Some ( $code) ) ,
339
+ }
340
+ } ;
341
+ ( server, $err: expr) => {
342
+ :: perseus:: GenericErrorWithCause {
343
+ error: $err. into( ) ,
344
+ cause: $crate:: ErrorCause :: Server ( :: std:: option:: Option :: None ) ,
345
+ }
346
+ } ;
347
+ ( server, $code: literal, $err: expr) => {
348
+ :: perseus:: GenericErrorWithCause {
349
+ error: $err. into( ) ,
350
+ cause: $crate:: ErrorCause :: Server ( :: std:: option:: Option :: Some ( $code) ) ,
351
+ }
352
+ } ;
353
+ }
You can’t perform that action at this time.
0 commit comments