I've implemented a very simple package for this, designed to be simple, readable and use the Result type from functional programming.
https://github.com/brunodantas/ensures