In C#, this has started to be covered by the ?? and ??= operators - null-coalescing operators - C# | Microsoft Learn.
For example, in C# you'll see
this.foo = foo ?? throw new ArgumentNullException(nameof(foo));
We could certainly have something like
let value = array.get(i) ☃ yeet "Err";
in rust to simplify this.
A previous thread: Something for coalescing; aka generalized/improved `or_else`
Note that, for bool, one can do this:
b || do yeet "uhoh";
And it'll work great, though the linter doesn't like it.