propensive / contingency

Safe and seamless validation and error aggregation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Try to find a way to flip the order of `mitigate` and `within`

propensive opened this issue · comments

Currently, the "mitigators" have to be defined before the body, which is not intuitive. It's not clear what would be the best way to do this, though.

One possible way may be to write it as a try/catch block within a mitigate block, like this:

mitigate:
  try
    // some action
  catch
    case SomeError() => NewError()

but it's not clear whether the block would be accepted before the macro rewrites it.

mitigate/within is effectively deprecated in favor of given ... fixes ... now.