Hey everyone, happy new year!
We at Trailblazer are wondering whether it’d make sense to establish an generic Errors object that can be used in Dry.rb, Rails and TRB. In Rails 6.1, there’s an approach here ActiveModel::Errors and in Dry.rb I’ve discovered MessageSet
and friends.
The API would be something along errors.add
, errors[:field]
and errors.messages
.
Background of this idea is we are introducing a stack-wide Errors object in TRB that is passed through operations and contracts and “enriched” with error messages on the way. As a matter of fact, we want this object’s API to be as close to Rails and Dry.rb as possible.
Is this something anyone would be interested in discussing? I don’t think it’s a big thing, and we’d love to use something DRY.rb in our code, as we won’t be using ActiveModel::Errors
most definitely.