Still not convinced this is a good way to do it. I think the following is better for two reasons:
- It is simpler and more readable at call site (no unnecessary indirection)
- It does not create an anonymous function every time a message is generated

```scala
private def guardedGenerate(message: Message, flags: Map[...]): Either[Throwable, AnyRef] = {
  try {
    Right(generate(message, flags))
  } ...
```