You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project I have a ton of code which uses `anyhow::Result`. I
want a convenient way to force a function to return a stock error
from a failpoint. Today this requires something like:
```
fail::fail_point!("main", true, |msg| {
let msg = msg.as_deref().unwrap_or("synthetic error");
Err(anyhow::anyhow!("{msg}"))
});
```
which is cumbersome to copy around.
Now, I conservatively made this a new macro. I am not sure how
often the use case of a fail point for an infallible (i.e. non-`Result`)
function occurs. It may make sense to require those to take
a distinct `inject_point!` or something?
Signed-off-by: Colin Walters <[email protected]>
0 commit comments