This is very helpful for more deeply nested schemas where it isn't clear which class is having its type check violated. Without it, the stacktrace and message provide little guidance, especially if there are multiple objects with the same attribute name.
Something like:
raise Schema::Attribute::TypeError, "#{val.inspect} of type #{val.class.name} cannot be assigned to attribute #{attribute_name.inspect} of type #{type.name} in #{self.name} (Strict: #{strict.inspect})
This is very helpful for more deeply nested schemas where it isn't clear which class is having its type check violated. Without it, the stacktrace and message provide little guidance, especially if there are multiple objects with the same attribute name.
Something like: